<?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[std::list]]></title><description><![CDATA[<p>Hallo Forum,</p>
<p>ich habe 2 Fragen zu Listen:<br />
1. Wenn ich eine Liste als Variable habe (nicht als Pointer) und dieser einer anderen Liste zuweise. Wird dann nur das Listenobjekt kopiert oder auch die darin liegenden Elemente?</p>
<p>2. Ich habe diese Liste:</p>
<pre><code class="language-cpp">std::list&lt;Myclass *&gt; m_oLstAbc;

// Und jetzt tue ich ein Obj rein und nehme es wieder raus:
m_oLstAbc.push_back(ptrMyclass);
Myclass *ptrCurrentMyclass = m_oLstAbc.pop_front();
</code></pre>
<p>Jetzt kommt diese Meldung.<br />
error C2440: 'Typumwandlung': 'void' kann nicht in 'Myclass *' konvertiert werden</p>
<p>Warum gibt er mir ein viod* heraus?</p>
<p>Vielen Dank</p>
<p>Luigi</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/256280/std-list</link><generator>RSS for Node</generator><lastBuildDate>Fri, 11 Sep 2026 10:43:13 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/256280.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 10 Dec 2009 13:57:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to std::list on Thu, 10 Dec 2009 13:57:43 GMT]]></title><description><![CDATA[<p>Hallo Forum,</p>
<p>ich habe 2 Fragen zu Listen:<br />
1. Wenn ich eine Liste als Variable habe (nicht als Pointer) und dieser einer anderen Liste zuweise. Wird dann nur das Listenobjekt kopiert oder auch die darin liegenden Elemente?</p>
<p>2. Ich habe diese Liste:</p>
<pre><code class="language-cpp">std::list&lt;Myclass *&gt; m_oLstAbc;

// Und jetzt tue ich ein Obj rein und nehme es wieder raus:
m_oLstAbc.push_back(ptrMyclass);
Myclass *ptrCurrentMyclass = m_oLstAbc.pop_front();
</code></pre>
<p>Jetzt kommt diese Meldung.<br />
error C2440: 'Typumwandlung': 'void' kann nicht in 'Myclass *' konvertiert werden</p>
<p>Warum gibt er mir ein viod* heraus?</p>
<p>Vielen Dank</p>
<p>Luigi</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1820612</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1820612</guid><dc:creator><![CDATA[Luigi_X]]></dc:creator><pubDate>Thu, 10 Dec 2009 13:57:43 GMT</pubDate></item><item><title><![CDATA[Reply to std::list on Thu, 10 Dec 2009 14:02:10 GMT]]></title><description><![CDATA[<p>Luigi_X schrieb:</p>
<blockquote>
<p>Hallo Forum,</p>
<p>ich habe 2 Fragen zu Listen:<br />
1. Wenn ich eine Liste als Variable habe (nicht als Pointer) und dieser einer anderen Liste zuweise. Wird dann nur das Listenobjekt kopiert oder auch die darin liegenden Elemente?</p>
</blockquote>
<p>Der Inhalt wird kopiert:</p>
<p><a href="http://www.cplusplus.com/reference/stl/list/operator=/" rel="nofollow">http://www.cplusplus.com/reference/stl/list/operator=/</a></p>
<blockquote>
<p>2. Ich habe diese Liste:</p>
<pre><code class="language-cpp">std::list&lt;Myclass *&gt; m_oLstAbc;

// Und jetzt tue ich ein Obj rein und nehme es wieder raus:
m_oLstAbc.push_back(ptrMyclass);
Myclass *ptrCurrentMyclass = m_oLstAbc.pop_front();
</code></pre>
<p>Jetzt kommt diese Meldung.<br />
error C2440: 'Typumwandlung': 'void' kann nicht in 'Myclass *' konvertiert werden</p>
<p>Warum gibt er mir ein viod* heraus?</p>
</blockquote>
<p>Weil pop_front nunmal void zurück gibt.</p>
<p><a href="http://www.cplusplus.com/reference/stl/list/pop_front/" rel="nofollow">http://www.cplusplus.com/reference/stl/list/pop_front/</a></p>
<p>Lies dir lieber erstmal die Referenz zu std::list durch, das wird wahrscheinlich alle weiteren Fragen beantworten:<br />
<a href="http://www.cplusplus.com/reference/stl/list/" rel="nofollow">http://www.cplusplus.com/reference/stl/list/</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1820621</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1820621</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Thu, 10 Dec 2009 14:02:10 GMT</pubDate></item><item><title><![CDATA[Reply to std::list on Thu, 10 Dec 2009 14:04:28 GMT]]></title><description><![CDATA[<p>Weil <a href="http://msdn.microsoft.com/en-us/library/s0xe8ba1%28VS.71%29.aspx" rel="nofollow">pop_front</a> dir überhaupt nichts zurück liefert.</p>
<p>Du kannst dir das erste Element mit <a href="http://msdn.microsoft.com/en-us/library/a5e17kyc%28VS.71%29.aspx" rel="nofollow">front</a> holen und es dann mit pop_front popen (wenn dass überhaupt das ist was du willst).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1820622</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1820622</guid><dc:creator><![CDATA[FrEEzE2046]]></dc:creator><pubDate>Thu, 10 Dec 2009 14:04:28 GMT</pubDate></item><item><title><![CDATA[Reply to std::list on Thu, 10 Dec 2009 14:11:31 GMT]]></title><description><![CDATA[<p>Oh, man sollte natürlich noch erwähnen, dass der Operator = nicht auf magische Weise deep-copies macht. Der ruft einfach nur = für alle Elemente auf. Wenn du in deiner Liste blanke Zeiger gespeichert hast, werden daher nur die Zeiger kopiert, nicht die Objekte auf die gezeigt wird.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1820631</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1820631</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Thu, 10 Dec 2009 14:11:31 GMT</pubDate></item><item><title><![CDATA[Reply to std::list on Thu, 10 Dec 2009 14:24:53 GMT]]></title><description><![CDATA[<p>Vielen Dank SeppJ und FrEEzE2046 <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 />
Ich werde das nächste Mal vorher im Internet suchen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1820653</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1820653</guid><dc:creator><![CDATA[Luigi_X]]></dc:creator><pubDate>Thu, 10 Dec 2009 14:24:53 GMT</pubDate></item></channel></rss>