|
Boost : |
From: Roland Richter (roland_at_[hidden])
Date: 2003-06-07 09:32:52
>> + Problems with MSVC++ 7.0 (as ever) and dereference (I guess this is
>> a problem with default types). Demonstrated with reverse_iterator:
>>
>>
>> int numbers[] = { 1,2,3,4,5,6,7 };
>> const int N = sizeof(numbers)/sizeof(int);
>> std::vector<int> v( numbers, numbers + N );
>>
>> typedef boost::reverse_iterator< std::vector<int>::iterator >
>> reverse_iterator;
>> reverse_iterator rit( v.begin() );
>>
>> if( *rit == v[0] ) // Does not compile
>> { }
>>
>> if( v[0] == *rit ) // Does not compile
>> { }
>
>
> What is the error message you get? ** Did you read it? **
>
> The problem is most likely that vc7 has no partial specialization and
> thus can't deduce the value_type of an int*.
Very well, here is it: (and of course I read it):
==========
\boost-sandbox\libs\view\test\dereference_equality_test.cpp(15) : error C2676: binary '==' :
'boost::iterator_facade<Derived,Value,AccessCategory,TraversalCategory,Reference,Difference>::reference'
does not define this operator or a conversion to a type acceptable to the predefined operator
with
[
Derived=boost::reverse_iterator<_STL::vector<int,_STL::allocator<int>>::iterator>,
Value=boost::mpl::apply_if<boost::is_same<boost::use_default,boost::use_default>,boost::iterator_value<_STL::vector<int,_STL::allocator<int>>::iterator
>,boost::mpl::identity<boost::use_default>>::type,
AccessCategory=boost::mpl::apply_if<boost::detail::is_new_iterator_tag<boost::detail::iterator_adaptor_base<boost::reverse_iterator<_STL::vector<int,_STL::allocator<int>>::iterator>,_STL::vector<int,_STL::allocator<int>>::iterator
,boost::use_default,boost::use_default,boost::use_default,boost::use_default>::category>,boost::detail::new_category_to_access<boost::detail::iterator_adaptor_base<boost::reverse_iterator<_STL::vector<int,_STL::allocator<int>>::iterator>,_STL::vector<int,_STL::allocator<int>>::iterator
,boost::use_default,boost::use_default,boost::use_default,boost::use_default>::category,boost::detail::iterator_adaptor_base<boost::reverse_iterator<_STL::vector<int,_STL::allocator<int>>::iterator>,_STL::vector<int,_STL::allocator<int>>::iterator
,boost::use_default,boost::use_default,boost::use_default,boost::use_default>::reference>,boost::detail::iter_category_to_access<boost::detail::iterator_adaptor_base<boost::reverse_iterator<_STL::vector<int,_STL::allocator<int>>::iterator>,_STL::vector<int,_STL::allocator<int>>::iterator
,boost::use_default,boost::use_default,boost::use_default,boost::use_default>::category,boost::detail::iterator_adaptor_base<boost::reverse_iterator<_STL::vector<int,_STL::allocator<int>>::iterator>,_STL::vector<int,_STL::allocator<int>>::iterator
,boost::use_default,boost::use_default,boost::use_default,boost::use_default>::reference>>::type,
TraversalCategory=boost::mpl::apply_if<boost::detail::is_new_iterator_tag<boost::detail::iterator_adaptor_base<boost::reverse_iterator<_STL::vector<int,_STL::allocator<int>>::iterator>,_STL::vector<int,_STL::allocator<int>>::iterator
,boost::use_default,boost::use_default,boost::use_default,boost::use_default>::category>,boost::detail::get_traversal_category<boost::detail::iterator_adaptor_base<boost::reverse_iterator<_STL::vector<int,_STL::allocator<int>>::iterator>,_STL::vector<int,_STL::allocator<int>>::iterator
,boost::use_default,boost::use_default,boost::use_default,boost::use_default>::category>,boost::detail::iter_category_to_traversal<boost::detail::iterator_adaptor_base<boost::reverse_iterator<_STL::vector<int,_STL::allocator<int>>::iterator>,_STL::vector<int,_STL::allocator<int>>::iterator
,boost::use_default,boost::use_default,boost::use_default,boost::use_default>::category>>::type,
Reference=boost::detail::iterator_adaptor_base<boost::reverse_iterator<_STL::vector<int,_STL::allocator<int>>::iterator>,_STL::vector<int,_STL::allocator<int>>::iterator
,boost::use_default,boost::use_default,boost::use_default,boost::use_default>::reference,
Difference=boost::mpl::apply_if<boost::is_same<boost::use_default,boost::use_default>,boost::iterator_difference<_STL::vector<int,_STL::allocator<int>>::iterator
>,boost::mpl::identity<boost::use_default>>::type
]
\boost-sandbox\libs\view\test\dereference_equality_test.cpp(18) : error C2677: binary '==' : no
global operator found which takes type
'boost::iterator_facade<Derived,Value,AccessCategory,TraversalCategory,Reference,Difference>::reference'
(or there is no acceptable conversion)
with
[
Derived=boost::reverse_iterator<_STL::vector<int,_STL::allocator<int>>::iterator>,
Value=boost::mpl::apply_if<boost::is_same<boost::use_default,boost::use_default>,boost::iterator_value<_STL::vector<int,_STL::allocator<int>>::iterator
>,boost::mpl::identity<boost::use_default>>::type,
AccessCategory=boost::mpl::apply_if<boost::detail::is_new_iterator_tag<boost::detail::iterator_adaptor_base<boost::reverse_iterator<_STL::vector<int,_STL::allocator<int>>::iterator>,_STL::vector<int,_STL::allocator<int>>::iterator
,boost::use_default,boost::use_default,boost::use_default,boost::use_default>::category>,boost::detail::new_category_to_access<boost::detail::iterator_adaptor_base<boost::reverse_iterator<_STL::vector<int,_STL::allocator<int>>::iterator>,_STL::vector<int,_STL::allocator<int>>::iterator
,boost::use_default,boost::use_default,boost::use_default,boost::use_default>::category,boost::detail::iterator_adaptor_base<boost::reverse_iterator<_STL::vector<int,_STL::allocator<int>>::iterator>,_STL::vector<int,_STL::allocator<int>>::iterator
,boost::use_default,boost::use_default,boost::use_default,boost::use_default>::reference>,boost::detail::iter_category_to_access<boost::detail::iterator_adaptor_base<boost::reverse_iterator<_STL::vector<int,_STL::allocator<int>>::iterator>,_STL::vector<int,_STL::allocator<int>>::iterator
,boost::use_default,boost::use_default,boost::use_default,boost::use_default>::category,boost::detail::iterator_adaptor_base<boost::reverse_iterator<_STL::vector<int,_STL::allocator<int>>::iterator>,_STL::vector<int,_STL::allocator<int>>::iterator
,boost::use_default,boost::use_default,boost::use_default,boost::use_default>::reference>>::type,
TraversalCa
tegory=boost::mpl::apply_if<boost::detail::is_new_iterator_tag<boost::detail::iterator_adaptor_base<boost::reverse_iterator<_STL::vector<int,_STL::allocator<int>>::iterator>,_STL::vector<int,_STL::allocator<int>>::iterator
,boost::use_default,boost::use_default,boost::use_default,boost::use_default>::category>,boost::detail::get_traversal_category<boost::detail::iterator_adaptor_base<boost::reverse_iterator<_STL::vector<int,_STL::allocator<int>>::iterator>,_STL::vector<int,_STL::allocator<int>>::iterator
,boost::use_default,boost::use_default,boost::use_default,boost::use_default>::category>,boost::detail::iter_category_to_traversal<boost::detail::iterator_adaptor_base<boost::reverse_iterator<_STL::vector<int,_STL::allocator<int>>::iterator>,_STL::vector<int,_STL::allocator<int>>::iterator
,boost::use_default,boost::use_default,boost::use_default,boost::use_default>::category>>::type,
Reference=boost::detail::iterator_adaptor_base<boost::reverse_iterator<_STL::vector<int,_STL::allocator<int>>::iterator>,_STL::vector<int,_STL::allocator<int>>::iterator
,boost::use_default,boost::use_default,boost::use_default,boost::use_default>::reference,
Difference=boost::mpl::apply_if<boost::is_same<boost::use_default,boost::use_default>,boost::iterator_difference<_STL::vector<int,_STL::allocator<int>>::iterator
>,boost::mpl::identity<boost::use_default>>::type
]
> If you manually specialize boost::detail::iterator_traits it should work.
>
The problem is the reference type. Yes, it works if you manually pass
all (or some) of the types; then again, this would require to include
thse types into the definition of reverse_iterator etc.
- Roland
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk