<?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[Konstante Liste durchgehen?]]></title><description><![CDATA[<p>Hallo Forum,</p>
<p>ich habe eine Funktion die eine konstante Liste zurück gibt. Wie kann ich nun die Liste durchgehen?<br />
Ich habe diese Beispiel aus der hiesiegen Container FAQ abgewandelte:</p>
<pre><code class="language-cpp">const list&lt;wstring&gt;* oList = oMain-&gt;GetList();
for (list&lt;wstring&gt;::iterator iter = oList-&gt;begin();
	iter!=oList-&gt;end(); 
	++iter) {
	cout &lt;&lt; *iter &lt;&lt; endl;
}
</code></pre>
<p>Die Fehlermeldung ist:</p>
<blockquote>
<p>error C2440: 'initializing' : cannot convert from 'class std::list&lt;class std::basic_string&lt;unsigned short,struct std::char_traits&lt;unsigned short&gt;,class std::allocator&lt;unsigned short&gt; &gt;,class std::allocator&lt;class std::basic_string&lt;unsigned short,struct std::char_traits&lt;unsigned short&gt;,class std::allocator&lt;unsigned short&gt; &gt; &gt; &gt;::const_iterator' to 'class std::list&lt;class std::basic_string&lt;unsigned short,struct std::char_traits&lt;unsigned short&gt;,class std::allocator&lt;unsigned short&gt; &gt;,class std::allocator&lt;class std::basic_string&lt;unsigned short,struct std::char_traits&lt;unsigned short&gt;,class std::allocator&lt;unsigned short&gt; &gt; &gt; &gt;::iterator'<br />
No constructor could take the source type, or constructor overload resolution was ambiguous<br />
error C2678: binary '!=' : no operator defined which takes a left-hand operand of type 'class std::list&lt;class std::basic_string&lt;unsigned short,struct std::char_traits&lt;unsigned short&gt;,class std::allocator&lt;unsigned sho<br />
rt&gt; &gt;,class std::allocator&lt;class std::basic_string&lt;unsigned short,struct std::char_traits&lt;unsigned short&gt;,class std::allocator&lt;unsigned short&gt; &gt; &gt; &gt;::iterator' (or there is no acceptable conversion)<br />
error C2679: binary '&lt;&lt;' : no operator defined which takes a right-hand operand of type 'class std::basic_string&lt;unsigned short,struct std::char_traits&lt;unsigned short&gt;,class std::allocator&lt;unsigned short&gt; &gt;' (or there is no acceptable conversion)</p>
</blockquote>
<p>Könntet Ihr mir einen Tip geben was ich falsch mache?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/182106/konstante-liste-durchgehen</link><generator>RSS for Node</generator><lastBuildDate>Tue, 22 Sep 2026 12:13:45 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/182106.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 21 May 2007 15:26:35 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Konstante Liste durchgehen? on Mon, 21 May 2007 15:26:35 GMT]]></title><description><![CDATA[<p>Hallo Forum,</p>
<p>ich habe eine Funktion die eine konstante Liste zurück gibt. Wie kann ich nun die Liste durchgehen?<br />
Ich habe diese Beispiel aus der hiesiegen Container FAQ abgewandelte:</p>
<pre><code class="language-cpp">const list&lt;wstring&gt;* oList = oMain-&gt;GetList();
for (list&lt;wstring&gt;::iterator iter = oList-&gt;begin();
	iter!=oList-&gt;end(); 
	++iter) {
	cout &lt;&lt; *iter &lt;&lt; endl;
}
</code></pre>
<p>Die Fehlermeldung ist:</p>
<blockquote>
<p>error C2440: 'initializing' : cannot convert from 'class std::list&lt;class std::basic_string&lt;unsigned short,struct std::char_traits&lt;unsigned short&gt;,class std::allocator&lt;unsigned short&gt; &gt;,class std::allocator&lt;class std::basic_string&lt;unsigned short,struct std::char_traits&lt;unsigned short&gt;,class std::allocator&lt;unsigned short&gt; &gt; &gt; &gt;::const_iterator' to 'class std::list&lt;class std::basic_string&lt;unsigned short,struct std::char_traits&lt;unsigned short&gt;,class std::allocator&lt;unsigned short&gt; &gt;,class std::allocator&lt;class std::basic_string&lt;unsigned short,struct std::char_traits&lt;unsigned short&gt;,class std::allocator&lt;unsigned short&gt; &gt; &gt; &gt;::iterator'<br />
No constructor could take the source type, or constructor overload resolution was ambiguous<br />
error C2678: binary '!=' : no operator defined which takes a left-hand operand of type 'class std::list&lt;class std::basic_string&lt;unsigned short,struct std::char_traits&lt;unsigned short&gt;,class std::allocator&lt;unsigned sho<br />
rt&gt; &gt;,class std::allocator&lt;class std::basic_string&lt;unsigned short,struct std::char_traits&lt;unsigned short&gt;,class std::allocator&lt;unsigned short&gt; &gt; &gt; &gt;::iterator' (or there is no acceptable conversion)<br />
error C2679: binary '&lt;&lt;' : no operator defined which takes a right-hand operand of type 'class std::basic_string&lt;unsigned short,struct std::char_traits&lt;unsigned short&gt;,class std::allocator&lt;unsigned short&gt; &gt;' (or there is no acceptable conversion)</p>
</blockquote>
<p>Könntet Ihr mir einen Tip geben was ich falsch mache?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1289197</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1289197</guid><dc:creator><![CDATA[Jakata]]></dc:creator><pubDate>Mon, 21 May 2007 15:26:35 GMT</pubDate></item><item><title><![CDATA[Reply to Konstante Liste durchgehen? on Mon, 21 May 2007 15:43:05 GMT]]></title><description><![CDATA[<p>...</p>
<pre><code class="language-cpp">for (list&lt;wstring&gt;::const_iterator
</code></pre>
<p>??</p>
<p>Steht da eigentlich auch in der Fehlermeldung:</p>
<p>Jakata schrieb:</p>
<blockquote>
<blockquote>
<p>error C2440: 'initializing' : cannot convert from '... ::const_iterator' to '...::iterator'</p>
</blockquote>
</blockquote>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /><br />
Ist aber &quot;normal&quot;, dass man das nicht sieht. Ist eigentlich eher eine der Fehlermeldungen der Art &quot;Wenn ich die Lösung schon habe, verstehe ich auch den Hinweis&quot;. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f921.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--clown_face"
      title=":clown:"
      alt="🤡"
    /></p>
<p>Gruß,</p>
<p>Simon2.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1289207</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1289207</guid><dc:creator><![CDATA[Simon2]]></dc:creator><pubDate>Mon, 21 May 2007 15:43:05 GMT</pubDate></item><item><title><![CDATA[Reply to Konstante Liste durchgehen? on Mon, 21 May 2007 15:40:54 GMT]]></title><description><![CDATA[<p>Vielen Dank <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>
<p>Für einen Anfänger ist das nicht so leicht...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1289210</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1289210</guid><dc:creator><![CDATA[Jakata]]></dc:creator><pubDate>Mon, 21 May 2007 15:40:54 GMT</pubDate></item><item><title><![CDATA[Reply to Konstante Liste durchgehen? on Mon, 21 May 2007 15:44:18 GMT]]></title><description><![CDATA[<p>Jakata schrieb:</p>
<blockquote>
<p>Vielen Dank <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>
<p>Für einen Anfänger ist das nicht so leicht...</p>
</blockquote>
<p>Das stimmt !</p>
<p>Viel Erfolg noch,</p>
<p>Simon2.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1289216</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1289216</guid><dc:creator><![CDATA[Simon2]]></dc:creator><pubDate>Mon, 21 May 2007 15:44:18 GMT</pubDate></item></channel></rss>