Is it possible to use Boost ptr_containers with Boost zip iterators?
I switched from std::map to boost::ptr_map in my application and received
numerous complaints from the Microsoft Visual Studio C++ 2008 compiler. As
a small test I compiled \trunk\libs\iterator\test\zip_iterator_test.cpp from
Boost SVN which worked fine. Then I added the necessary ptr_container
include file, disabled a lot of extra tests and changed the definition of
the two vectors from
std::vector<double> vect1(3); to boost::ptr_vector<double> vect1(3); and
std::vector<double> vect2(3); to boost::ptr_vector<double> vect2(3);
Here is the error reported:
c:\boost svn\trunk\boost\tuple\detail\tuple_basic.hpp(373) : error C2664:
'std::_Vector_const_iterator<_Ty,_Alloc>::_Vector_const_iterator(const
std::_Vector_const_iterator<_Ty,_Alloc> &)' : cannot convert parameter 1
from 'const boost::void_ptr_iterator' to 'const
std::_Vector_const_iterator<_Ty,_Alloc> &'
with [ _Ty=double, _Alloc=std::allocator<double> ]
and [ VoidIter=std::_Vector_iterator>,
T=double ]
and [ _Ty=double, _Alloc=std::allocator<double> ]
Reason: cannot convert from 'const
boost::void_ptr_iterator' to 'const
std::_Vector_const_iterator<_Ty,_Alloc>'
with [ VoidIter=std::_Vector_iterator>, T=double ]
and [ _Ty=double, _Alloc=std::allocator<double> ]
No user-defined-conversion operator available that can perform this
conversion, or the operator cannot be called
c:\boost svn\trunk\boost\tuple\detail\tuple_basic.hpp(626) : see
reference to function template instantiation
'boost::tuples::cons::consboost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,b...::type>>(const
boost::tuples::consboost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,b...::type>>
&)' being compiled with
[HT=std::_Vector_const_iterator,TT=boost::tuples::cons,boost::tuples::detail::map_tuple_to_consboost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,b...::type>,
T0=boost::void_ptr_iterator>,double> ]
c:\documents and settings\chuck\my documents\visual studio
2005\projects\zip ptr container test\zip_ptr_container_test.cpp(267) : see
reference to function template instantiation
'boost::tuples::tuple::tuple,boost::tuples::cons>(const
boost::tuples::cons> &)' being compiled
with [
T0=std::_Vector_const_iterator,
T1=std::_Vector_const_iterator,
VoidIter=std::_Vector_iterator>,
T=double,
HT=boost::void_ptr_iterator>,double>,
TT=boost::tuples::detail::map_tuple_to_consboost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,b...::type
]
The line 267 (line 295 in the original version) referred to is:
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() ) );
Is it the void pointer in the ptr_vector which causes the problem?
Can this marriage be saved?
--
Chuck