
The following simple problem produces an error when compiling with VC8+SP1 on Windows:
#include <vector> #include <boost/range/sub_range.hpp>
int main(int argc, char* argv[]) { typedef std::vector< int > VectorType; VectorType v; boost::sub_range< VectorType > range; boost::sub_range< VectorType > range1; range = range1; return 0; }
Ditto copy-assignment operator. The workaround is to write copy-constructor/assignment "by hand".
In fact, this can't explain the exact behavior of msvc. My sub_range seems to work well, though.
Shunsuke, Thanks for the analysis. I looked into this a bit more and found that the workaround added for VC7.1 is giving VC8 problems (by the way, it only happened in debug build, release build was fine). I removed the operator= that accepts sub_range r passed by value and everything started working. Specifically, I commented out the following code in sub_range.hpp: sub_range& operator=( sub_range r ) { // // argument passed by value to avoid // const_iterator to iterator conversion // base::operator=( r ); return *this; } Regards, Sean