16 Apr
2018
16 Apr
'18
9:06 p.m.
Hi All Does the Boost.Range library support initializer_list as a range type? I thought anything with begin() and end() methods was fair game, but this code doesn't work, unless I'm doing it wrong. #include <iostream> #include <vector> #include <boost/range/adaptor/reversed.hpp> int main( ) { using namespace std; using namespace boost::adaptors; vector<int> v { 1, 2, 3 }; for( int i : v | reversed ) { cout << i << " "; } // Ok for( int i : { 1, 2, 3 } | reversed ) { cout << i << " "; } // Bad } Kind Regards Rob.