<?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[List Erase &#x2F; Remove]]></title><description><![CDATA[<p>Hallo Allerseits,</p>
<p>Ich beschäftige mich gerade mit der STL und habe mich gerade an einer List versucht. Funktioniert auch soweit recht gut. Bis auf das remove oder erase.</p>
<p>Ich habe eine List aus Pointern auf ein Objekt gemacht.</p>
<pre><code>void Navigator::del(string loc){

for(list&lt;Ort*&gt;::const_iterator i = Locations.begin(); i != Locations.end(); i++){
        if((*i)-&gt;GetName()==loc){
            delete (*i);
            Locations.erase(i);
            cout &lt;&lt; &quot;Ort gelöscht!&quot; &lt;&lt;endl;
        }

}
}
</code></pre>
<p>Ich bekomme bei Locations.erase(i) die Fehlermeldung &quot;Error, no matching function for call to...&quot;<br />
Also der Compiler sagt mir er erwartet etwas anderes als ich in der Funktion übergebe. Dabei übergebe ich einen Iterator und das ist genau das was doch die Funktion verlangt... Bei einem Komilitonen funktioniert das seltsamerweise. Warum bei mir nicht?</p>
<p>Vielen Dank für euren Rat schonmal.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/332582/list-erase-remove</link><generator>RSS for Node</generator><lastBuildDate>Mon, 27 Apr 2026 17:58:57 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/332582.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 09 May 2015 16:13:13 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to List Erase &#x2F; Remove on Sat, 09 May 2015 16:14:32 GMT]]></title><description><![CDATA[<p>Hallo Allerseits,</p>
<p>Ich beschäftige mich gerade mit der STL und habe mich gerade an einer List versucht. Funktioniert auch soweit recht gut. Bis auf das remove oder erase.</p>
<p>Ich habe eine List aus Pointern auf ein Objekt gemacht.</p>
<pre><code>void Navigator::del(string loc){

for(list&lt;Ort*&gt;::const_iterator i = Locations.begin(); i != Locations.end(); i++){
        if((*i)-&gt;GetName()==loc){
            delete (*i);
            Locations.erase(i);
            cout &lt;&lt; &quot;Ort gelöscht!&quot; &lt;&lt;endl;
        }

}
}
</code></pre>
<p>Ich bekomme bei Locations.erase(i) die Fehlermeldung &quot;Error, no matching function for call to...&quot;<br />
Also der Compiler sagt mir er erwartet etwas anderes als ich in der Funktion übergebe. Dabei übergebe ich einen Iterator und das ist genau das was doch die Funktion verlangt... Bei einem Komilitonen funktioniert das seltsamerweise. Warum bei mir nicht?</p>
<p>Vielen Dank für euren Rat schonmal.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2453113</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2453113</guid><dc:creator><![CDATA[Cabooze]]></dc:creator><pubDate>Sat, 09 May 2015 16:14:32 GMT</pubDate></item><item><title><![CDATA[Reply to List Erase &#x2F; Remove on Sat, 09 May 2015 16:23:46 GMT]]></title><description><![CDATA[<p>Du übergibst einen const_iterator, die Funktion erwartet aber vor C++11 einen iterator.<br />
Darüber hinaus verwendest du rohe, besitzende Pointer, die du manuell deleten musst. Verwende Smartpointer, die löschen deine Objekte automatisch.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2453115</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2453115</guid><dc:creator><![CDATA[Nathan]]></dc:creator><pubDate>Sat, 09 May 2015 16:23:46 GMT</pubDate></item><item><title><![CDATA[Reply to List Erase &#x2F; Remove on Sat, 09 May 2015 16:30:43 GMT]]></title><description><![CDATA[<p>Okay alles klar danke <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="🙂"
    /><br />
Funktioniert</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2453116</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2453116</guid><dc:creator><![CDATA[Cabooze]]></dc:creator><pubDate>Sat, 09 May 2015 16:30:43 GMT</pubDate></item><item><title><![CDATA[Reply to List Erase &#x2F; Remove on Sat, 09 May 2015 17:35:51 GMT]]></title><description><![CDATA[<pre><code>auto i = Locations.begin()
</code></pre>
<p>dürfte in diesem Fall das Ganze etwas leichter machen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2453124</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2453124</guid><dc:creator><![CDATA[hardware]]></dc:creator><pubDate>Sat, 09 May 2015 17:35:51 GMT</pubDate></item><item><title><![CDATA[Reply to List Erase &#x2F; Remove on Thu, 14 May 2015 11:04:39 GMT]]></title><description><![CDATA[<p>i++ nach erase?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2453487</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2453487</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Thu, 14 May 2015 11:04:39 GMT</pubDate></item></channel></rss>