15 Mar
2013
15 Mar
'13
3:23 p.m.
Robert Jones wrote:
copy( counting_range( 1, 5 ) | reversed | transformed( f ), std::ostream_iterator<int>( std::cout, " " ) ); std::cout << std::endl;
copy( counting_range( 1, 5 ) | reversed | transformed( bind( f, _1 ) ), std::ostream_iterator<int>( std::cout, " " ) ); std::cout << std::endl;
[...]
Which is...
8 6 4 2 1768406272 1768406272 1768406272 1768406272
This is because dereferencing `reverse_iterator` of `counting_iterator` makes a reference to a dead temporary. See #2640 https://svn.boost.org/trac/boost/ticket/2640 Use `irange( 1, 5 )` instead. Regards, Michel