<?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[boost::sub_range, boost::ptr_vector und boost::foreach]]></title><description><![CDATA[<p>Moin moin,</p>
<p>ich nutze in meinem Code sub_range zumannen mit einem ptr_vector<br />
und zusammen mit foreach. <a href="http://paste.pocoo.org/show/350286/" rel="nofollow">Ein Beispiel</a>.</p>
<p>Ich kann mir das ehrlich gesagt nicht erklären. Warum gehen die<br />
anderen beiden Fälle?</p>
<p>Gruß, Panke</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/283275/boost-sub_range-boost-ptr_vector-und-boost-foreach</link><generator>RSS for Node</generator><lastBuildDate>Sat, 22 Aug 2026 18:15:08 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/283275.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 08 Mar 2011 17:07:50 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to boost::sub_range, boost::ptr_vector und boost::foreach on Tue, 08 Mar 2011 17:07:50 GMT]]></title><description><![CDATA[<p>Moin moin,</p>
<p>ich nutze in meinem Code sub_range zumannen mit einem ptr_vector<br />
und zusammen mit foreach. <a href="http://paste.pocoo.org/show/350286/" rel="nofollow">Ein Beispiel</a>.</p>
<p>Ich kann mir das ehrlich gesagt nicht erklären. Warum gehen die<br />
anderen beiden Fälle?</p>
<p>Gruß, Panke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2031412</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2031412</guid><dc:creator><![CDATA[Panke]]></dc:creator><pubDate>Tue, 08 Mar 2011 17:07:50 GMT</pubDate></item><item><title><![CDATA[Reply to boost::sub_range, boost::ptr_vector und boost::foreach on Tue, 08 Mar 2011 19:13:47 GMT]]></title><description><![CDATA[<p>Ich bin zu faul das jetzt zu compilieren.</p>
<p>Was bedeutet &quot;geht nicht&quot;?<br />
Und wenn du so wenig Code hast, dann brauchste keinen pastebin.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2031461</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2031461</guid><dc:creator><![CDATA[otze]]></dc:creator><pubDate>Tue, 08 Mar 2011 19:13:47 GMT</pubDate></item><item><title><![CDATA[Reply to boost::sub_range, boost::ptr_vector und boost::foreach on Tue, 08 Mar 2011 19:40:19 GMT]]></title><description><![CDATA[<p>Ups, sorry. Die Fehlermeldung lautet:</p>
<blockquote>
<p>/home/tobias/Projects/mobev/svn/trunk/prototype/test.cpp:24: error: invalid initialization of reference of type ‘A&amp;’ from expression of type ‘const A’</p>
</blockquote>
<p>In der Zeile vom ersten foreach. Ich nutze den pastebin, weil man von da<br />
den Quelltext direkt als datei runterladen kann, weil man ihn direkt verändern<br />
und neu hochladen kann etc.</p>
<p>Das ist einfach viel bequemer als 90% der Foren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2031472</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2031472</guid><dc:creator><![CDATA[Panke]]></dc:creator><pubDate>Tue, 08 Mar 2011 19:40:19 GMT</pubDate></item><item><title><![CDATA[Reply to boost::sub_range, boost::ptr_vector und boost::foreach on Tue, 08 Mar 2011 20:04:04 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>elements gibt die Range als Kopie zurück. Diese Kopie ist ein ein r-value und kein l-value. Normale Referenzen sind aber l-value Referenzen. Eine r-value Referenz würde man mit &amp;&amp; statt &amp; schreiben. Aber das trifft hier einfach nicht den Sinn, du brauchst wahrscheinlich einfach keine Kopie.</p>
<p>Jedenfalls lässt sich das Problem leicht lösen:<br />
a) A statt A&amp; in Schleife nutzen<br />
b) A&amp; in element() zurückliefern<br />
c) const A&amp; statt A&amp; nutzen</p>
<p>Variante c) macht wohl am meisten Sinn, da Du einfach auf keiner Kopie etwas ändern möchtest.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2031475</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2031475</guid><dc:creator><![CDATA[Eisflamme]]></dc:creator><pubDate>Tue, 08 Mar 2011 20:04:04 GMT</pubDate></item><item><title><![CDATA[Reply to boost::sub_range, boost::ptr_vector und boost::foreach on Tue, 08 Mar 2011 20:06:08 GMT]]></title><description><![CDATA[<p>Danke! Das hat geholfen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2031484</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2031484</guid><dc:creator><![CDATA[Panke]]></dc:creator><pubDate>Tue, 08 Mar 2011 20:06:08 GMT</pubDate></item></channel></rss>