Boost C++ Libraries: Ticket #10789: unexpected behaviour with boost range join on rvalue https://svn.boost.org/trac10/ticket/10789 <p> I'm trying to append one element to a range, and iterate over the resulting compound range. When the rhs of the <code>join</code> is an lvalue, everything seems ok. However, when the rhs of the <code>join</code> is an rvalue, I'm seeing something unexpected. </p> <p> Specifically, when such a joined range is accessed directly by a <code>for(auto e : range)</code> loop, or when it is saved in a variable using <code>auto</code>, then iterated over, the singleton in the second container is not produced correctly. If however the joined range is passed by reference (other than non-const lvalue, obviously), then iterated over, the result is correct. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10789 Trac 1.4.3 Matei David <matei@…> Thu, 13 Nov 2014 07:05:43 GMT attachment set https://svn.boost.org/trac10/ticket/10789 https://svn.boost.org/trac10/ticket/10789 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">example-join.cpp</span> </li> </ul> Ticket Matei David <matei@…> Thu, 13 Nov 2014 07:11:20 GMT <link>https://svn.boost.org/trac10/ticket/10789#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10789#comment:1</guid> <description> <p> I'm using <code>gcc-4.8.2</code> and <code>clang-3.5</code>. I'm compiling with: </p> <pre class="wiki">[g++|clang++] -std=c++11 -Wall -Wextra -pedantic example-join.cpp -o example-join </pre><p> The results I'm seeing are either "12 34", which is ok, or "12 0", which is not ok. Note that the last element is not even default constructed (which would be 99, not 0). </p> </description> <category>Ticket</category> </item> </channel> </rss>