|
Boost Users : |
Subject: Re: [Boost-users] Implementing python's enumerate with iterator adaptors
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2012-04-17 11:32:47
On Tue, Apr 17, 2012 at 8:04 AM, Jens Auer <jensa_at_[hidden]> wrote:
> Thanks for all the suggestions, they are highly welcome. The output of the
> MS compiler with the error message is:
> 1>d:\programme\microsoft visual studio 10.0\vc\include\xutility(728):
> error C2665: 'std::_Debug_range2' : none of the 2 overloads could convert
> all the argument types
> 1> d:\programme\microsoft visual studio
> 10.0\vc\include\xutility(703): could be 'void
> std::_Debug_range2<_InIt>(_InIt,_InIt,std::_Dbfile_t,std::_Dbline_t,std::input_iterator_tag)'
> 1> with
> 1> [
> 1>
> _InIt=Iterator::Enumerator<std::_Vector_iterator<std::_Vector_val<int,std::allocator<int>>>,int>
> 1> ]
> 1> d:\programme\microsoft visual studio
> 10.0\vc\include\xutility(711): or 'void
> std::_Debug_range2<_InIt>(_RanIt,_RanIt,std::_Dbfile_t,std::_Dbline_t,std::random_access_iterator_tag)'
> 1> with
> 1> [
> 1>
> _InIt=Iterator::Enumerator<std::_Vector_iterator<std::_Vector_val<int,std::allocator<int>>>,int>,
> 1>
> _RanIt=Iterator::Enumerator<std::_Vector_iterator<std::_Vector_val<int,std::allocator<int>>>,int>
> 1> ]
> 1> while trying to match the argument list
> '(Iterator::Enumerator<Iterator,T>, Iterator::Enumerator<Iterator,T>,
> std::_Dbfile_t, std::_Dbline_t, boost::random_access_traversal_tag)'
> 1> with
> 1> [
> 1>
> Iterator=std::_Vector_iterator<std::_Vector_val<int,std::allocator<int>>>,
> 1> T=int
> 1> ]
> 1> d:\programme\microsoft visual studio
> 10.0\vc\include\algorithm(30) : see reference to function template
> instantiation 'void
> std::_Debug_range<_InIt>(_InIt,_InIt,std::_Dbfile_t,std::_Dbline_t)' being
> compiled
> 1> with
> 1> [
> 1>
> _InIt=Iterator::Enumerator<std::_Vector_iterator<std::_Vector_val<int,std::allocator<int>>>,int>
> 1> ]
> 1> c:\software
> development\svn\swdev\cap\mblib\iterator\enumerate.cpp(27) : see reference
> to function template instantiation '_Fn1
> std::for_each<Iterator::Enumerator<Iterator,T>,`anonymous-namespace'::`anonymous-namespace'::<lambda0>>(_InIt,_InIt,_Fn1)'
> being compiled
> 1> with
> 1> [
> 1>
> _Fn1=`anonymous-namespace'::`anonymous-namespace'::<lambda0>,
> 1>
> Iterator=std::_Vector_iterator<std::_Vector_val<int,std::allocator<int>>>,
> 1> T=int,
> 1>
> _InIt=Iterator::Enumerator<std::_Vector_iterator<std::_Vector_val<int,std::allocator<int>>>,int>
> 1> ]
>
> If anybody is interested I can create a small solution with a project file
> to reproduce it.
>
Looks like
boost::random_access_traversal_tag
doesn't have a "best conversion" among
std::input_iterator_tag
std::random_access_iterator_tag
My guess is this is where that proxy reference bites you, as it makes your
Enumerator iterator not strictly a random access iterator, even though it
morally is, so boost::iterator_facade won't set your iterator_category to
std::random_access_iterator_tag and instead tries to go a
middle-of-the-road approach (IIRC). Try typedef'ing
typedef std::random_access_iterator_tag iterator_category; // I think this
is right...
in your Enumerator definition and see if MSVC complains?
- Jeff
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net