Pairing ptr_containers with zip iterators

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<VoidIter,T>' to 'const std::_Vector_const_iterator<_Ty,_Alloc> &' with [ _Ty=double, _Alloc=std::allocator<double> ] and [ VoidIter=std::_Vector_iterator<void *,std::allocator<void *>>, T=double ] and [ _Ty=double, _Alloc=std::allocator<double> ] Reason: cannot convert from 'const boost::void_ptr_iterator<VoidIter,T>' to 'const std::_Vector_const_iterator<_Ty,_Alloc>' with [ VoidIter=std::_Vector_iterator<void *,std::allocator<void *>>, 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<HT,TT>::cons<T0,boost::tuples::cons<T0,boost::tuples::detail::map_tuple_to_cons<boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type>::type>>(const boost::tuples::cons<T0,boost::tuples::cons<T0,boost::tuples::detail::map_tuple_to_cons<boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type>::type>> &)' being compiled with [HT=std::_Vector_const_iterator<double,std::allocator<double>>,TT=boost::tuples::cons<std::_Vector_const_iterator<double,std::allocator<double>>,boost::tuples::detail::map_tuple_to_cons<boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type>::type>, T0=boost::void_ptr_iterator<std::_Vector_iterator<void *,std::allocator<void *>>,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<T0,T1>::tuple<boost::void_ptr_iterator<VoidIter,T>,boost::tuples::cons<HT,TT>>(const boost::tuples::cons<HT,boost::tuples::cons<HT,TT>> &)' being compiled with [ T0=std::_Vector_const_iterator<double,std::allocator<double>>, T1=std::_Vector_const_iterator<double,std::allocator<double>>, VoidIter=std::_Vector_iterator<void *,std::allocator<void *>>, T=double, HT=boost::void_ptr_iterator<std::_Vector_iterator<void *,std::allocator<void *>>,double>, TT=boost::tuples::detail::map_tuple_to_cons<boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type,boost::tuples::null_type>::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

Charles Brockman <cmbrockman <at> verizon.net> writes:
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);
...
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() ) );
Sounds like you're mixing a ptr_vector with std::vector iterators. I guess line 267 needs changing from vector<double>::const_iterator to boost::ptr_vector<double>::const_iterator?

Charles Brockman skrev:
Is it possible to use Boost ptr_containers with Boost zip iterators?
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?
Perhaps. Try to replace std::vector<double> with boost::ptr_vector<double> in your tuple type. -Thorsten

Thorsten Ottosen wrote:
Perhaps. Try to replace std::vector<double> with boost::ptr_vector<double> in your tuple type.
Thank you Thorsten and Richard. As a coworker of mine would say when shown an obvious answer that was staring him in the face, "The printing was just too close to the page." I fixed the typedefs which allowed the test program to compile. Alas, I prudently used a typedef in my own application program when changing from std::map to boost::ptr_map. That typedef is correct. My minimal test example is not a true representation of my application program's problem. In the latter case when constructing the combining iterators, I'm getting: boost::detail::error_not_related_by_convertibility<T1,T2>' : base class undefined and 'type' : is not a member of 'boost::detail::minimum_category_impl<false,false>::apply<T1,T2> I'm going back in another attempt to decipher the error messages and perhaps construct a small example program which demonstrates the problem. -- Chuck

Charles Brockman skrev:
Thorsten Ottosen wrote:
I fixed the typedefs which allowed the test program to compile. Alas, I prudently used a typedef in my own application program when changing from std::map to boost::ptr_map. That typedef is correct. My minimal test example is not a true representation of my application program's problem. In the latter case when constructing the combining iterators, I'm getting: boost::detail::error_not_related_by_convertibility<T1,T2>' : base class undefined and 'type' : is not a member of 'boost::detail::minimum_category_impl<false,false>::apply<T1,T2>
I'm going back in another attempt to decipher the error messages and perhaps construct a small example program which demonstrates the problem.
There are some minor differences between std::map<K,T> and boost::ptr_map<K,T> and if this the types that gives you errors, it might be due to these differences. For example, boost::ptr_map<K,T>:::value_type is not a std::pair<const K,T>. There are also some difference in the way constness is handled, which might also be the source of your problem. Anyway, I would like to know more. best regards -Thorsten

Thorsten Ottosen wrote:
There are some minor differences between std::map<K,T> and boost::ptr_map<K,T> and if this the types that gives you errors, it might be due to these differences. For example, boost::ptr_map<K,T>:::value_type is not a std::pair<const K,T>. There are also some difference in the way constness is handled, which might also be the source of your problem. Anyway, I would like to know more.
,boost::ptr_map_iterator<std::_Tree<std::_Tmap_traits<int,void *,std::less<int>,std::allocator<std::pair<const int,void *>>,false>>::iterator,int,int *const >>] c:\boost svn\trunk\boost\iterator\zip_iterator.hpp(457) : see reference to class template instantiation 'boost::detail::zip_iterator_base<IteratorTuple>' being compiled with [IteratorTuple=boost::tuples::tuple<boost::ptr_map_iterator<std::_Tree<std::_Tmap_traits<int,void *,std::less<int>,std::allocator<std::pair<const int,void *>>,false>>::iterator,int,int *const ,boost::ptr_map_iterator<std::_Tree<std::_Tmap_traits<int,void *,std::less<int>,std::allocator<std::pair<const int,void *>>,false>>::iterator,int,int *const >>] c:\documents and settings\chuck\my documents\visual studio 2005\projects\zip ptr container test\zip_ptr_container_test.cpp(19) : see reference to class template instantiation 'boost::zip_iterator<IteratorTuple>' being compiled with [IteratorTuple=boost::tuples::tuple<boost::ptr_map_iterator<std::_Tree<std::_Tmap_traits<int,void *,std::less<int>,std::allocator<std::pair<const int,void *>>,false>>::iterator,int,int *const ,boost::ptr_map_iterator<std::_Tree<std::_Tmap_traits<int,void *,std::less<int>,std::allocator<std::pair<const int,void *>>,false>>::iterator,int,int *const >>] c:\boost svn\trunk\boost\iterator\detail\minimum_category.hpp(91) : error C2039: 'type' : is not a member of 'boost::detail::minimum_category_impl<false,false>::apply<T1,T2>' with [T1=boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>, T2=boost::random_access_traversal_tag] c:\boost svn\trunk\boost\iterator\detail\minimum_category.hpp(91) : error C2146: syntax error : missing ';' before identifier 'type' c:\boost svn\trunk\boost\iterator\detail\minimum_category.hpp(91) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\boost svn\trunk\boost\iterator\detail\minimum_category.hpp(91) : error C2602: 'boost::detail::minimum_category<T1,T2>::type' is not a member of a
I constructed this short do-nothing program, zip_ptr_container_test.cpp. // #include <boost/tuple/tuple.hpp> #include <boost/iterator/zip_iterator.hpp> #include <map> #include <boost/ptr_container/ptr_map.hpp> using boost::zip_iterator; using boost::tuple; using boost::make_tuple; using boost::ptr_map; using std::map; int main() { //typedef map<int, int> theMapType; typedef boost::ptr_map<int, int> theMapType; typedef zip_iterator <tuple<theMapType::iterator, theMapType::iterator> > zipIter; theMapType map1; theMapType map2; zipIter(make_tuple(map1.begin(), map2.begin())); } // The program compiles without errors when the map typedef is enabled. However, when the ptr_map typedef is active, I receive these errors: c:\boost svn\trunk\boost\iterator\detail\minimum_category.hpp(72) : error C2504: 'boost::detail::error_not_related_by_convertibility<T1,T2>' : base class undefined with [T1=boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>, T2=boost::random_access_traversal_tag] c:\boost svn\trunk\boost\iterator\detail\minimum_category.hpp(91) : see reference to class template instantiation 'boost::detail::minimum_category_impl<false,false>::apply<T1,T2>' being compiled with [T1=boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>, T2=boost::random_access_traversal_tag] c:\boost svn\trunk\boost\mpl\aux_\has_type.hpp(20) : see reference to class template instantiation 'boost::detail::minimum_category<T1,T2>' being compiled with [T1=boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>, T2=boost::random_access_traversal_tag] c:\boost svn\trunk\boost\mpl\aux_\preprocessed\plain\quote.hpp(53) : see reference to class template instantiation 'boost::mpl::aux::has_type<T>' being compiled with [T=boost::detail::minimum_category<boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>,boost::random_access_traversal_tag>] c:\boost svn\trunk\boost\mpl\aux_\preprocessed\plain\apply_wrap.hpp(49) : see reference to class template instantiation 'boost::mpl::quote2<F,Tag>::apply<U1,U2>' being compiled with [F=boost::detail::minimum_category, Tag=boost::mpl::void_, U1=boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>, U2=boost::random_access_traversal_tag] c:\boost svn\trunk\boost\mpl\aux_\preprocessed\plain\bind.hpp(207) : see reference to class template instantiation 'boost::mpl::apply_wrap2<F,T1,T2>' being compiled with [F=boost::mpl::quote2<boost::detail::minimum_category,boost::mpl::void_>, T1=boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>, T2=boost::random_access_traversal_tag] c:\boost svn\trunk\boost\mpl\aux_\preprocessed\plain\apply_wrap.hpp(49) : see reference to class template instantiation 'boost::mpl::bind2<F,T1,T2>::apply<U1,U2>' being compiled with [F=boost::mpl::quote2<boost::detail::minimum_category,boost::mpl::void_>, T1=boost::mpl::arg<1>, T2=boost::mpl::arg<2>, U1=boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>, U2=boost::random_access_traversal_tag] c:\boost svn\trunk\boost\mpl\aux_\preprocessed\plain\apply.hpp(63) : see reference to class template instantiation 'boost::mpl::apply_wrap2<F,T1,T2>' being compiled with [F=boost::mpl::protect<boost::mpl::bind2<boost::mpl::quote2<boost::detail::minimum_category,boost::mpl::void_>,boost::mpl::arg<1>,boost::mpl::arg<2>>>, T1=boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>, T2=boost::random_access_traversal_tag] c:\boost svn\trunk\boost\iterator\zip_iterator.hpp(159) : see reference to class template instantiation 'boost::mpl::apply2<F,T1,T2>' being compiled with [F=boost::mpl::protect<boost::mpl::bind2<boost::mpl::quote2<boost::detail::minimum_category,boost::mpl::void_>,boost::mpl::arg<1>,boost::mpl::arg<2>>>, T1=boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>, T2=boost::random_access_traversal_tag] c:\boost svn\trunk\boost\mpl\eval_if.hpp(41) : see reference to class template instantiation 'boost::detail::tuple_impl_specific::tuple_meta_accumulate_impl<Tuple,BinaryMetaFun,StartType>' being compiled with [Tuple=boost::tuples::cons<boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>,boost::tuples::null_type>, BinaryMetaFun=boost::detail::minimum_category<boost::mpl::_1,boost::mpl::_2>, StartType=boost::random_access_traversal_tag] c:\boost svn\trunk\boost\iterator\zip_iterator.hpp(184) : see reference to class template instantiation 'boost::mpl::eval_if<C,F1,F2>' being compiled with [C=boost::is_same<boost::tuples::cons<boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>,boost::tuples::null_type>,boost::tuples::null_type>, F1=boost::mpl::identity<boost::random_access_traversal_tag>, F2=boost::detail::tuple_impl_specific::tuple_meta_accumulate_impl<boost::tuples::cons<boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>,boost::tuples::null_type>,boost::detail::minimum_category<boost::mpl::_1,boost::mpl::_2>,boost::random_access_traversal_tag>] c:\boost svn\trunk\boost\iterator\zip_iterator.hpp(158) : see reference to class template instantiation 'boost::detail::tuple_impl_specific::tuple_meta_accumulate<Tuple,BinaryMetaFun,StartType>' being compiled with [Tuple=boost::tuples::cons<boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>,boost::tuples::null_type>, BinaryMetaFun=boost::detail::minimum_category<boost::mpl::_1,boost::mpl::_2>, StartType=boost::random_access_traversal_tag] c:\boost svn\trunk\boost\mpl\eval_if.hpp(41) : see reference to class template instantiation 'boost::detail::tuple_impl_specific::tuple_meta_accumulate_impl<Tuple,BinaryMetaFun,StartType>' being compiled with [Tuple=boost::tuples::cons<boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>,boost::tuples::cons<boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>,boost::tuples::null_type>>, BinaryMetaFun=boost::detail::minimum_category<boost::mpl::_1,boost::mpl::_2>, StartType=boost::random_access_traversal_tag] c:\boost svn\trunk\boost\iterator\zip_iterator.hpp(184) : see reference to class template instantiation 'boost::mpl::eval_if<C,F1,F2>' being compiled with [C=boost::is_same<boost::tuples::cons<boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>,boost::tuples::cons<boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>,boost::tuples::null_type>>,boost::tuples::null_type>, F1=boost::mpl::identity<boost::random_access_traversal_tag>, F2=boost::detail::tuple_impl_specific::tuple_meta_accumulate_impl<boost::tuples::cons<boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>,boost::tuples::cons<boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>,boost::tuples::null_type>>,boost::detail::minimum_category<boost::mpl::_1,boost::mpl::_2>,boost::random_access_traversal_tag>] c:\boost svn\trunk\boost\iterator\zip_iterator.hpp(367) : see reference to class template instantiation 'boost::detail::tuple_impl_specific::tuple_meta_accumulate<Tuple,BinaryMetaFun,StartType>' being compiled with [Tuple=boost::tuples::cons<boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>,boost::tuples::cons<boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>,boost::tuples::null_type>>, BinaryMetaFun=boost::detail::minimum_category<boost::mpl::_1,boost::mpl::_2>, StartType=boost::random_access_traversal_tag] c:\boost svn\trunk\boost\iterator\zip_iterator.hpp(430) : see reference to class template instantiation 'boost::detail::minimum_traversal_category_in_iterator_tuple<IteratorTuple>' being compiled with [IteratorTuple=boost::tuples::tuple<boost::ptr_map_iterator<std::_Tree<std::_Tmap_traits<int,void *,std::less<int>,std::allocator<std::pair<const int,void *>>,false>>::iterator,int,int *const base class of 'boost::detail::minimum_category<T1,T2>' with [T1=boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>, T2=boost::random_access_traversal_tag] c:\boost svn\trunk\boost\iterator\detail\minimum_category.hpp(91) : see declaration of 'boost::detail::minimum_category<T1,T2>::type' with [T1=boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>, T2=boost::random_access_traversal_tag] c:\boost svn\trunk\boost\iterator\detail\minimum_category.hpp(91) : error C2868: 'boost::detail::minimum_category<T1,T2>::type' : illegal syntax for using-declaration; expected qualified-name with [T1=boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>, T2=boost::random_access_traversal_tag] c:\boost svn\trunk\boost\iterator\detail\minimum_category.hpp(72) : error C2504: 'boost::detail::error_not_related_by_convertibility<T1,T2>' : base class undefined with [T1=boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>, T2=int] c:\boost svn\trunk\boost\iterator\detail\minimum_category.hpp(91) : see reference to class template instantiation 'boost::detail::minimum_category_impl<false,false>::apply<T1,T2>' being compiled with [T1=boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>, T2=int] c:\boost svn\trunk\boost\mpl\aux_\has_type.hpp(20) : see reference to class template instantiation 'boost::detail::minimum_category<T1,T2>' being compiled with [T1=boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>, T2=int] c:\boost svn\trunk\boost\mpl\aux_\preprocessed\plain\quote.hpp(53) : see reference to class template instantiation 'boost::mpl::aux::has_type<T>' being compiled with [T=boost::detail::minimum_category<boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>,int>] c:\boost svn\trunk\boost\mpl\aux_\preprocessed\plain\apply_wrap.hpp(49) : see reference to class template instantiation 'boost::mpl::quote2<F,Tag>::apply<U1,U2>' being compiled with [F=boost::detail::minimum_category, Tag=boost::mpl::void_, U1=boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>, U2=int] c:\boost svn\trunk\boost\mpl\aux_\preprocessed\plain\bind.hpp(207) : see reference to class template instantiation 'boost::mpl::apply_wrap2<F,T1,T2>' being compiled with [F=boost::mpl::quote2<boost::detail::minimum_category,boost::mpl::void_>, T1=boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>, T2=int] c:\boost svn\trunk\boost\mpl\aux_\preprocessed\plain\apply_wrap.hpp(49) : see reference to class template instantiation 'boost::mpl::bind2<F,T1,T2>::apply<U1,U2>' being compiled with [F=boost::mpl::quote2<boost::detail::minimum_category,boost::mpl::void_>, T1=boost::mpl::arg<1>, T2=boost::mpl::arg<2>, U1=boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>, U2=int] c:\boost svn\trunk\boost\mpl\aux_\preprocessed\plain\apply.hpp(63) : see reference to class template instantiation 'boost::mpl::apply_wrap2<F,T1,T2>' being compiled with [F=boost::mpl::protect<boost::mpl::bind2<boost::mpl::quote2<boost::detail::minimum_category,boost::mpl::void_>,boost::mpl::arg<1>,boost::mpl::arg<2>>>, T1=boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>, T2=int] c:\boost svn\trunk\boost\iterator\zip_iterator.hpp(159) : see reference to class template instantiation 'boost::mpl::apply2<F,T1,T2>' being compiled with [F=boost::mpl::protect<boost::mpl::bind2<boost::mpl::quote2<boost::detail::minimum_category,boost::mpl::void_>,boost::mpl::arg<1>,boost::mpl::arg<2>>>, T1=boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>, T2=int] c:\boost svn\trunk\boost\iterator\detail\minimum_category.hpp(91) : error C2039: 'type' : is not a member of 'boost::detail::minimum_category_impl<false,false>::apply<T1,T2>' with [T1=boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>, T2=int] c:\boost svn\trunk\boost\iterator\detail\minimum_category.hpp(91) : error C2146: syntax error : missing ';' before identifier 'type' c:\boost svn\trunk\boost\iterator\detail\minimum_category.hpp(91) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\boost svn\trunk\boost\iterator\detail\minimum_category.hpp(91) : error C2602: 'boost::detail::minimum_category<T1,T2>::type' is not a member of a base class of 'boost::detail::minimum_category<T1,T2>' with [T1=boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>, T2=int] c:\boost svn\trunk\boost\iterator\detail\minimum_category.hpp(91) : see declaration of 'boost::detail::minimum_category<T1,T2>::type' with [T1=boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>, T2=int] c:\boost svn\trunk\boost\iterator\detail\minimum_category.hpp(91) : error C2868: 'boost::detail::minimum_category<T1,T2>::type' : illegal syntax for using-declaration; expected qualified-name with [T1=boost::detail::iterator_category_with_traversal<std::input_iterator_tag,boost::bidirectional_traversal_tag>, T2=int] c:\boost svn\trunk\boost\mpl\eval_if.hpp(41) : error C2516: 'boost::mpl::if_<T1,T2,T3>::type' : is not a legal base class with [T1=boost::is_convertible<int,std::output_iterator_tag>, T2=boost::mpl::identity<boost::incrementable_traversal_tag>, T3=void] c:\boost svn\trunk\boost\mpl\if.hpp(70) : see declaration of 'boost::mpl::if_<T1,T2,T3>::type' with [T1=boost::is_convertible<int,std::output_iterator_tag>, T2=boost::mpl::identity<boost::incrementable_traversal_tag>, T3=void] c:\boost svn\trunk\boost\mpl\eval_if.hpp(41) : see reference to class template instantiation 'boost::mpl::eval_if<C,F1,F2>' being compiled with [C=boost::is_convertible<int,std::output_iterator_tag>, F1=boost::mpl::identity<boost::incrementable_traversal_tag>, F2=void] c:\boost svn\trunk\boost\mpl\eval_if.hpp(41) : see reference to class template instantiation 'boost::mpl::eval_if<C,F1,F2>' being compiled with [C=boost::is_convertible<int,std::input_iterator_tag>,F1=boost::mpl::identity<boost::single_pass_traversal_tag>, F2=boost::mpl::eval_if<boost::is_convertible<int,std::output_iterator_tag>,boost::mpl::identity<boost::incrementable_traversal_tag>,void>] c:\boost svn\trunk\boost\mpl\eval_if.hpp(41) : see reference to class template instantiation 'boost::mpl::eval_if<C,F1,F2>' being compiled with [C=boost::is_convertible<int,std::forward_iterator_tag>, F1=boost::mpl::identity<boost::forward_traversal_tag>, F2=boost::mpl::eval_if<boost::is_convertible<int,std::input_iterator_tag>,boost::mpl::identity<boost::single_pass_traversal_tag>,boost::mpl::eval_if<boost::is_convertible<int,std::output_iterator_tag>,boost::mpl::identity<boost::incrementable_traversal_tag>,void>>] c:\boost svn\trunk\boost\mpl\eval_if.hpp(41) : see reference to class template instantiation 'boost::mpl::eval_if<C,F1,F2>' being compiled with [C=boost::is_convertible<int,std::bidirectional_iterator_tag>, F1=boost::mpl::identity<boost::bidirectional_traversal_tag>, F2=boost::mpl::eval_if<boost::is_convertible<int,std::forward_iterator_tag>,boost::mpl::identity<boost::forward_traversal_tag>,boost::mpl::eval_if<boost::is_convertible<int,std::input_iterator_tag>,boost::mpl::identity<boost::single_pass_traversal_tag>,boost::mpl::eval_if<boost::is_convertible<int,std::output_iterator_tag>,boost::mpl::identity<boost::incrementable_traversal_tag>,void>>>] c:\boost svn\trunk\boost\iterator\iterator_categories.hpp(98) : see reference to class template instantiation 'boost::mpl::eval_if<C,F1,F2>' being compiled with [C=boost::is_convertible<int,std::random_access_iterator_tag>, F1=boost::mpl::identity<boost::random_access_traversal_tag>, F2=boost::mpl::eval_if<boost::is_convertible<int,std::bidirectional_iterator_tag>,boost::mpl::identity<boost::bidirectional_traversal_tag>,boost::mpl::eval_if<boost::is_convertible<int,std::forward_iterator_tag>,boost::mpl::identity<boost::forward_traversal_tag>,boost::mpl::eval_if<boost::is_convertible<int,std::input_iterator_tag>,boost::mpl::identity<boost::single_pass_traversal_tag>,boost::mpl::eval_if<boost::is_convertible<int,std::output_iterator_tag>,boost::mpl::identity<boost::incrementable_traversal_tag>,void>>>>] c:\boost svn\trunk\boost\mpl\eval_if.hpp(41) : see reference to class template instantiation 'boost::detail::old_category_to_traversal<Cat>' being compiled with [Cat=int] c:\boost svn\trunk\boost\iterator\iterator_categories.hpp(155) : see reference to class template instantiation 'boost::mpl::eval_if<C,F1,F2>' being compiled with [C=boost::is_convertible<int,boost::incrementable_traversal_tag>, F1=boost::mpl::identity<int>, F2=boost::detail::old_category_to_traversal<int>] c:\boost svn\trunk\boost\iterator\detail\facade_iterator_category.hpp(176) : see reference to class template instantiation 'boost::iterator_category_to_traversal<Cat>' being compiled with [Cat=int] c:\boost svn\trunk\boost\mpl\eval_if.hpp(41) : see reference to class template instantiation 'boost::detail::facade_iterator_category_impl<Traversal,ValueParam,Reference>' being compiled with [Traversal=int, ValueParam=boost::tuples::cons<boost::ptr_container_detail::ref_pair<int,int *const >,boost::tuples::cons<boost::ptr_container_detail::ref_pair<int,int *const >,boost::tuples::null_type>>, Reference=boost::tuples::cons<boost::ptr_container_detail::ref_pair<int,int *const >,boost::tuples::cons<boost::ptr_container_detail::ref_pair<int,int *const >,boost::tuples::null_type>>] c:\boost svn\trunk\boost\iterator\detail\facade_iterator_category.hpp(193) : see reference to class template instantiation 'boost::mpl::eval_if<C,F1,F2>' being compiled with [C=boost::detail::is_iterator_category<int>, F1=boost::mpl::identity<int>, F2=boost::detail::facade_iterator_category_impl<int,boost::tuples::cons<boost::ptr_container_detail::ref_pair<int,int *const >,boost::tuples::cons<boost::ptr_container_detail::ref_pair<int,int *const
,boost::tuples::null_type>>,boost::tuples::cons<boost::ptr_container_detail::ref_pair<int,int *const >,boost::tuples::cons<boost::ptr_container_detail::ref_pair<int,int *const >,boost::tuples::null_type>>>] c:\boost svn\trunk\boost\iterator\iterator_facade.hpp(104) : see reference to class template instantiation 'boost::detail::facade_iterator_category<CategoryOrTraversal,ValueParam,Reference>' being compiled with [CategoryOrTraversal=int, ValueParam=boost::tuples::cons<boost::ptr_container_detail::ref_pair<int,int *const >,boost::tuples::cons<boost::ptr_container_detail::ref_pair<int,int *const >,boost::tuples::null_type>>, Reference=boost::tuples::cons<boost::ptr_container_detail::ref_pair<int,int *const >,boost::tuples::cons<boost::ptr_container_detail::ref_pair<int,int *const >,boost::tuples::null_type>>] c:\boost svn\trunk\boost\iterator\iterator_facade.hpp(627) : see reference to class template instantiation 'boost::detail::iterator_facade_types<ValueParam,CategoryOrTraversal,Reference,Difference>' being compiled with [ValueParam=boost::tuples::cons<boost::ptr_container_detail::ref_pair<int,int *const >,boost::tuples::cons<boost::ptr_container_detail::ref_pair<int,int *const >,boost::tuples::null_type>>, CategoryOrTraversal=int, Reference=boost::tuples::cons<boost::ptr_container_detail::ref_pair<int,int *const >,boost::tuples::cons<boost::ptr_container_detail::ref_pair<int,int *const >,boost::tuples::null_type>>, Difference=__w64 int] c:\boost svn\trunk\boost\iterator\zip_iterator.hpp(458) : see reference to class template instantiation 'boost::iterator_facade<Derived,Value,CategoryOrTraversal,Reference,Difference>' being compiled with [Derived=boost::zip_iterator<boost::tuples::tuple<boost::ptr_map_iterator<std::_Tree<std::_Tmap_traits<int,void *,std::less<int>,std::allocator<std::pair<const int,void *>>,false>>::iterator,int,int *const ,boost::ptr_map_iterator<std::_Tree<std::_Tmap_traits<int,void *,std::less<int>,std::allocator<std::pair<const int,void *>>,false>>::iterator,int,int *const >>>, Value=boost::tuples::cons<boost::ptr_container_detail::ref_pair<int,int *const >,boost::tuples::cons<boost::ptr_container_detail::ref_pair<int,int *const >,boost::tuples::null_type>>, CategoryOrTraversal=int, Reference=boost::tuples::cons<boost::ptr_container_detail::ref_pair<int,int *const >,boost::tuples::cons<boost::ptr_container_detail::ref_pair<int,int *const >,boost::tuples::null_type>>, Difference=__w64 int] c:\boost svn\trunk\boost\iterator\detail\facade_iterator_category.hpp(176) : error C2039: 'type' : is not a member of 'boost::iterator_category_to_traversal<Cat>' with [Cat=int] c:\boost svn\trunk\boost\iterator\detail\facade_iterator_category.hpp(177) : error C2146: syntax error : missing ',' before identifier 'type' c:\boost svn\trunk\boost\iterator\detail\facade_iterator_category.hpp(177) : error C2065: 'type' : undeclared identifier c:\boost svn\trunk\boost\iterator\detail\facade_iterator_category.hpp(180) : error C3203: 'is_same' : unspecialized class template can't be used as a template argument for template parameter 'T1', expected a real type c:\boost svn\trunk\boost\iterator\detail\facade_iterator_category.hpp(180) : error C2955: 'boost::is_same' : use of class template requires template argument list c:\boost svn\trunk\boost\type_traits\is_same.hpp(37) : see declaration of 'boost::is_same' c:\boost svn\trunk\boost\iterator\detail\facade_iterator_category.hpp(180) : error C2955: 'boost::mpl::if_' : use of class template requires template argument list c:\boost svn\trunk\boost\mpl\if.hpp(56) : see declaration of 'boost::mpl::if_'
Are these problems correctable? -- Charles Brockman

Charles Brockman skrev:
Thorsten Ottosen wrote:
There are some minor differences between std::map<K,T> and boost::ptr_map<K,T> and if this the types that gives you errors, it might be due to these differences. For example, boost::ptr_map<K,T>:::value_type is not a std::pair<const K,T>. There are also some difference in the way constness is handled, which might also be the source of your problem. Anyway, I would like to know more.
I constructed this short do-nothing program, zip_ptr_container_test.cpp. // #include <boost/tuple/tuple.hpp> #include <boost/iterator/zip_iterator.hpp> #include <map> #include <boost/ptr_container/ptr_map.hpp>
using boost::zip_iterator; using boost::tuple; using boost::make_tuple; using boost::ptr_map; using std::map;
int main() { //typedef map<int, int> theMapType; typedef boost::ptr_map<int, int> theMapType; typedef zip_iterator <tuple<theMapType::iterator, theMapType::iterator> > zipIter; theMapType map1; theMapType map2; zipIter(make_tuple(map1.begin(), map2.begin())); } [snip]
Are these problems correctable?
I can't figure out where the error is from that. Gcc also fails to compile it, which is good. I don't understand the metaprogramming machinery that boost.iterator is doing here, but apparently my implementation of ptr_map's iterators somehow violate a requirement. -Thorsten

Thorsten Ottosen wrote:
I can't figure out where the error is from that. Gcc also fails to compile it, which is good. I don't understand the metaprogramming machinery that boost.iterator is doing here, but apparently my implementation of ptr_map's iterators somehow violate a requirement.
You have set my mind at ease. I'll either go back to std::map and continue to use the zip iterator or use ptr_map and deal with a pair of individual iterators. -- Chuck Brockman

Charles Brockman wrote:
Are these problems correctable?
If I correctly understand, this is a bug of zip_iterator. zip_iterator can't zip some strange iterators. I think this bug can be fixed by one line patch. But I'm afraid to touch Boost.Iterator, which is combatting legacy compilers. :-) An easy workaround is to include: http://tinyurl.com/ytcprt Regards, -- Shunsuke Sogame

shunsuke wrote:
If I correctly understand, this is a bug of zip_iterator. zip_iterator can't zip some strange iterators. I think this bug can be fixed by one line patch. But I'm afraid to touch Boost.Iterator, which is combatting legacy compilers. :-)
An easy workaround is to include: http://tinyurl.com/ytcprt
Thank you. Now my test program compiles. I hope that one day the fix can be incorporated into either zip iterator or ptr_container. (I feel as though I'm operating in the upper reaches of C++ where the air is thin.) By the way, the /detail/prefix.hpp file included by your pstade/boost_tuple_config.hpp is superfluous. It does nothing. -- Charles Brockman
participants (4)
-
Charles Brockman
-
Richard Webb
-
shunsuke
-
Thorsten Ottosen