
21 Apr
2011
21 Apr
'11
8:32 p.m.
On Thu, Apr 21, 2011 at 1:07 PM, Michel MORIN <mimomorin@gmail.com> wrote:
Sometimes it is convenient to apply range adaptors to a temporary container and iterate over it:
// `using namespace boost::adaptors;` is assumed BOOST_FOREACH(auto x, std::string("Hello, world!") | reversed) {...}
However, the lifetime of the temporary container ends before the loop body begins.
[...] I believe BOOST_FOREACH correctly accounts for rvalue range expressions. See second-to-last example from http://www.boost.org/doc/libs/1_46_1/doc/html/foreach.html Does this address your concern? - Jeff