
"Dalton, Barnaby" <Barnaby.Dalton@brevanhoward.com> writes:
I'm using MSVC 7.1 and am getting masses of compile errors with the following code (see end of message for the errors):
#include <boost/iterator/zip_iterator.hpp> #include <vector> #include <functional> #include <boost/detail/workaround.hpp>
int main( void ) {
std::vector<double> vect1(3); std::vector<double> vect2(3);
// boost::zip_iterator< // boost::tuples::tuple< // std::vector<double>::const_iterator, // std::vector<double>::const_iterator // > // > // zip_it_begin( // boost::make_tuple( // vect1.begin(), // vect2.begin() // ) // );
std::vector<boost::tuples::tuple<double, double> > vect_of_tuples(3);
std::copy( boost::make_zip_iterator( boost::make_tuple( vect1.begin(), vect2.begin() ) ), boost::make_zip_iterator( boost::make_tuple( vect1.end(), vect2.end() ) ), vect_of_tuples.begin() );
return 0; }
If I uncomment the earlier instantiation of zip_it_begin then it compiles without any errors! I'm guessing this is some kind of compiler bug but and am wondering what the correct/most elegant workaround is?
Well, I don't know, but if you haven't already done so you might try the latest Boost CVS instead of 1.32. If the problem disappears that would be the easiest solution.
Do I have make sure I manually declare a zip_iterator somewhere before using make_zip_iterator?
Can't tell ya. I do note that the one you declared is using constant iterators while the one you're building with make_zip_iterator is using mutable iterators. Sorry I'm not more clue-ful here. This looks like a good question for Microsoft support ;-) -- Dave Abrahams Boost Consulting www.boost-consulting.com