<?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[A commonly unknown std::vector pitfall]]></title><description><![CDATA[<p><a href="http://www.reddit.com/r/cpp/comments/vog1p/a_commonly_unknown_stdvector_pitfall/" rel="nofollow">http://www.reddit.com/r/cpp/comments/vog1p/a_commonly_unknown_stdvector_pitfall/</a></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/305483/a-commonly-unknown-std-vector-pitfall</link><generator>RSS for Node</generator><lastBuildDate>Sat, 08 Aug 2026 19:02:46 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/305483.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 30 Jun 2012 11:24:58 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to A commonly unknown std::vector pitfall on Sat, 30 Jun 2012 11:24:58 GMT]]></title><description><![CDATA[<p><a href="http://www.reddit.com/r/cpp/comments/vog1p/a_commonly_unknown_stdvector_pitfall/" rel="nofollow">http://www.reddit.com/r/cpp/comments/vog1p/a_commonly_unknown_stdvector_pitfall/</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2228648</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2228648</guid><dc:creator><![CDATA[hinweis]]></dc:creator><pubDate>Sat, 30 Jun 2012 11:24:58 GMT</pubDate></item><item><title><![CDATA[Reply to A commonly unknown std::vector pitfall on Sat, 30 Jun 2012 12:34:13 GMT]]></title><description><![CDATA[<p>Das ist kein Common Pitfall von std::vector sondern einfach ein Bug in den Optimierungen von der C++ Standard Library vom VC++.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2228665</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2228665</guid><dc:creator><![CDATA[Shade Of Mine]]></dc:creator><pubDate>Sat, 30 Jun 2012 12:34:13 GMT</pubDate></item><item><title><![CDATA[Reply to A commonly unknown std::vector pitfall on Sat, 30 Jun 2012 13:00:31 GMT]]></title><description><![CDATA[<p>Shade Of Mine schrieb:</p>
<blockquote>
<p>Das ist kein Common Pitfall von std::vector sondern einfach ein Bug in den Optimierungen von der C++ Standard Library vom VC++.</p>
</blockquote>
<p>D.h. man müsste, falls man mit VS arbeitet, zuerst eine Kopie von <code>v.front()</code> machen und dann die Kopie an <code>push_back</code> übergeben?</p>
<p>Also praktisch so:</p>
<pre><code class="language-cpp">int main()
{
	int ar[] = { 10,20,30 };

	vector&lt;int&gt; vec(ar,ar+3);

	vec.push_back( int(vec.front()) );
}
</code></pre>
<p>Ist ja total doof.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2228670</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2228670</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Sat, 30 Jun 2012 13:00:31 GMT</pubDate></item><item><title><![CDATA[Reply to A commonly unknown std::vector pitfall on Sat, 30 Jun 2012 12:54:57 GMT]]></title><description><![CDATA[<p>wie in dem Kommentaren des VC-Entwicklers steht: es funktioniert auf VC.</p>
<blockquote>
<p>It's a headache because it's yet another tricky thing we have to get right. We've broken push_back() in the past, and emplace_back() is currently broken. It's certainly not our greatest headache, though.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/2228671</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2228671</guid><dc:creator><![CDATA[otze]]></dc:creator><pubDate>Sat, 30 Jun 2012 12:54:57 GMT</pubDate></item></channel></rss>