<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Problem mit List]]></title><description><![CDATA[<p>Hi.<br />
Kann mir vllt jemand sagen, ob es möglich ist, das einzige Element einer List zu löschen?<br />
irgendwie bekomme ich da nur ein fehler.<br />
der src sieht im mom so aus:</p>
<pre><code class="language-cpp">openList.push_back(nStart);
	nParent=nStart;
	closedList.push_back(nParent);
	for(iList=openList.begin(); iList!=openList.end(); iList++)
	{
		Node temp(iList-&gt;x, iList-&gt;y, iList-&gt;iIndex, iList-&gt;iSourcePoint, iList-&gt;F, iList-&gt;G, iList-&gt;H);
		if(CompareFullNode(temp, nParent))
			iList=openList.erase(iList);
	}
</code></pre>
<p>nStart ist, wie auch nParent vom typ &quot;Node&quot;<br />
iList ist ein list&lt;Node&gt;::iterator</p>
<p>das prob is, das beim 1. durchlauf die liste nur ein eintrag hat, nämlich &quot;nStart&quot;, bei weiteren durchläufen ist sie größer - da funktioniert das löschen.<br />
nur eben nicht beim 1. eintrag.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/273521/problem-mit-list</link><generator>RSS for Node</generator><lastBuildDate>Fri, 28 Aug 2026 00:26:37 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/273521.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 08 Sep 2010 16:43:35 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem mit List on Wed, 08 Sep 2010 16:43:35 GMT]]></title><description><![CDATA[<p>Hi.<br />
Kann mir vllt jemand sagen, ob es möglich ist, das einzige Element einer List zu löschen?<br />
irgendwie bekomme ich da nur ein fehler.<br />
der src sieht im mom so aus:</p>
<pre><code class="language-cpp">openList.push_back(nStart);
	nParent=nStart;
	closedList.push_back(nParent);
	for(iList=openList.begin(); iList!=openList.end(); iList++)
	{
		Node temp(iList-&gt;x, iList-&gt;y, iList-&gt;iIndex, iList-&gt;iSourcePoint, iList-&gt;F, iList-&gt;G, iList-&gt;H);
		if(CompareFullNode(temp, nParent))
			iList=openList.erase(iList);
	}
</code></pre>
<p>nStart ist, wie auch nParent vom typ &quot;Node&quot;<br />
iList ist ein list&lt;Node&gt;::iterator</p>
<p>das prob is, das beim 1. durchlauf die liste nur ein eintrag hat, nämlich &quot;nStart&quot;, bei weiteren durchläufen ist sie größer - da funktioniert das löschen.<br />
nur eben nicht beim 1. eintrag.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1949838</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1949838</guid><dc:creator><![CDATA[Dagi]]></dc:creator><pubDate>Wed, 08 Sep 2010 16:43:35 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit List on Wed, 08 Sep 2010 16:50:54 GMT]]></title><description><![CDATA[<p>Das Löschen aus der Liste ist nicht das Problem, das funktioniert natürlich auch für ein Element. Der Fehler liegt woanders. Geh mal mit dem Debugger durch und guck, ob das Programm überhaupt beim erase ankommt. Immerhin steht direkt davor ein if, welches ja nicht zwangsläufig erfüllt ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1949841</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1949841</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Wed, 08 Sep 2010 16:50:54 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit List on Wed, 08 Sep 2010 17:37:27 GMT]]></title><description><![CDATA[<p>beim compare kann es eg kein problem geben.</p>
<p>1. is da nicht viel dazu</p>
<pre><code class="language-cpp">bool CompareFullNode(Node n1, Node n2)
{
	if(n1.F==n2.F &amp;&amp; n1.G==n2.G &amp;&amp; n1.H==n2.H &amp;&amp; n1.iIndex==n2.iIndex &amp;&amp;
		n1.iSourcePoint==n2.iSourcePoint &amp;&amp; n1.x==n2.x &amp;&amp; n1.y==n2.y)
		return true;
	return false;
}
</code></pre>
<p>und 2. hab ich schon getestet, ob das if klappt, wenn ich nur ne ausgabe mache.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1949857</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1949857</guid><dc:creator><![CDATA[Dagi]]></dc:creator><pubDate>Wed, 08 Sep 2010 17:37:27 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit List on Wed, 08 Sep 2010 18:04:14 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">openList.push_back(nStart);
    nParent=nStart;
    closedList.push_back(nParent);
    for(iList=openList.begin(); iList!=openList.end();)
    {
        Node temp(iList-&gt;x, iList-&gt;y, iList-&gt;iIndex, iList-&gt;iSourcePoint, iList-&gt;F, iList-&gt;G, iList-&gt;H);
        if(CompareFullNode(temp, nParent))
            iList=openList.erase(iList);
        else
           ++iList;
    }
</code></pre>
<p>Probier das mal. Ansonsten poste vollständigen Beispielcode, der das Problem beinhaltet.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1949869</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1949869</guid><dc:creator><![CDATA[---]]></dc:creator><pubDate>Wed, 08 Sep 2010 18:04:14 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit List on Thu, 09 Sep 2010 05:31:00 GMT]]></title><description><![CDATA[<p>Okay, hab das mal versucht, der fehler kommt jedoch noch immer.<br />
hier erstmal die funktion, um die es sich handelt</p>
<pre><code class="language-cpp">bool PathNodes::FindPath(void)
{
	PosVector2D vStart(nStart.x, nStart.y);
	PosVector2D vTarget(nTarget.x, nTarget.y);
	// Ist Der Startpunkt das Ziel?
	if(ComparePositions(vStart, vTarget))
		return true;	// Ja, ist er. Ziel gefunden...
	// Ist der Startpunkt in einer Wand?
	if(iPathMap[nStart.y][nStart.x]&lt;0)
		return false;	// Ja, ist er. So  gehts nicht...
	// Startpunkt in die offene Liste haun..
	openList.push_back(nStart);
	nParent=nStart;
	closedList.push_back(nParent);
	for(iList=openList.begin(); iList!=openList.end(); iList++)
	{
		Node temp(iList-&gt;x, iList-&gt;y, iList-&gt;iIndex, iList-&gt;iSourcePoint, iList-&gt;F, iList-&gt;G, iList-&gt;H);
		if(CompareFullNode(temp, nParent))
			iList=openList.erase(iList);
		else
			++iList;
	}
//	do
//	{
		if(openList.size()!=0)
			cout&lt;&lt;&quot;[openList]: Ist nicht leer, is ja was drinne... &quot;&lt;&lt;openList.size()&lt;&lt;endl;
		if(closedList.size()!=0)
			cout&lt;&lt;&quot;[closedList]: Ist nicht leer, is ja was drinne... &quot;&lt;&lt;closedList.size()&lt;&lt;endl;
//	} while(...)
	return true;
}
</code></pre>
<p>laut dem debugger kommt der fehler direkt bei der zeile mit &quot;-&gt;erase(..)&quot;<br />
hab leider keine ahnung was da nun falsch ist bzw wie ich das problem beheben kann <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1950041</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1950041</guid><dc:creator><![CDATA[Dagi]]></dc:creator><pubDate>Thu, 09 Sep 2010 05:31:00 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit List on Thu, 09 Sep 2010 05:54:11 GMT]]></title><description><![CDATA[<p>Du erhöhst den Iterator zu oft (einmal im Schleifenkopf sowie einmal wenn gelöscht oder nicht gelöscht wird). Nimm den Inkrement im Schleifenkopf raus.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1950045</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1950045</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Thu, 09 Sep 2010 05:54:11 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit List on Sat, 11 Sep 2010 13:16:29 GMT]]></title><description><![CDATA[<p>ah, danke, nun funktionert es.<br />
leider werd ich die funktion nun doch nicht mehr nutzen, weils nicht passt, wie ich will.<br />
trotzdem danke für eure hilfe <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1951293</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1951293</guid><dc:creator><![CDATA[Dagi]]></dc:creator><pubDate>Sat, 11 Sep 2010 13:16:29 GMT</pubDate></item></channel></rss>