abir basak wrote:
Hi, I am not sure if it is the proper newsgroup to get answers related to boost usage. I am facing a problem with boost::sub_range for a const container which is not allowing me to access the indexed operator. Below a short program to demonstrate the problem. Necessary headers are included. Boost version 1.33.1 typedef vector<int> VI; VI v(10); int data[] = {0,1,2,3,4,5,6,7,8,9}; copy(data,data+10,v.begin());///inserted a few int to std::vector<int>
Hm... this is not legal. May I suggest v = boost::assign::list_of(0)(1)(2)(3)(4)(5)(6) ... ; ?
///prints 0 1 2 3 4 5 6 7 8 9 copy(v.begin(),v.end(),ostream_iterator<int>(cout," ")); cout<
not allowed gives error under Visual Studio 7.1 cannot convert from 'const std::allocator<_Ty>::value_type' to 'boost::iterator_range<IteratorT>::value_type &' Why it tried to convert it to value_type& instead of const value_type& ? cout<
This is an error in the range lib that should be fixed in the upcoming version of boost. -Thorsten