On Thu, Jan 30, 2014 at 12:41 PM, Nathan Ridge
Hi Igor,
This is a known issue: see https://svn.boost.org/trac/boost/ticket/7630. (That bug talks about C++11 range-based for loops, but the issue with BOOST_FOREACH is the same).
I'm not sure what the status of this bug is. Jeffrey Yasskin posted a patch to that bug which I reviewed over email, but I haven't heard from him about it since.
Why was the review not done on the bug? I'm tracking that bug and would like to see it resolved, and it seems the patch is just fine. Are there any issues still that need to be addressed elsewhere? What can I do to help expedite this process?
Note that if you use C++11, a workaround is to use boost::for_each with a lambda instead, so
BOOST_FOREACH(SomeType v, range_rvalue | adaptor) { statements }
turns into
boost::for_each(range_rvalue | adaptor, [&](SomeType v) { statements });
Since the temporary lives until the end of the statement, and the whole loop is contained within the statement, there is no more undefined behaviour.
This is not an acceptable solution to the original problem.
Regards, Nate
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost