Boost logo

Boost Users :

From: Sean Huang (huangsean_at_[hidden])
Date: 2006-07-17 18:05:49


I encountered some problems while using counting_iterator. Suppose we have a
range called RangeType, and we define:
    typedef boost::counting_iterator< boost::range_value< RangeType >::type
> MyCountingIterator;

if I do:
    std::vector< int > vec( 100 );
    std::vector< int >:: iterator iter = vec.begin() + ( countingIter2 -
counitingIter1 );

VC8 would then complain about a conversion from __int64 to int because the
difference type of MyCountingIterator (using default) is __int64. Since we
treat warnings as errors. I then changed MyCountingIterator to
    typedef boost::counting_iterator< boost::range_value< RangeType >::type,
boost::use_default, boost::range_difference< RangeType >::type >
MyCountingIterator;

This time I got a different error:
iterator_facade.hpp(554) : error C2784: '__w64 int
boost::counting_iterator<Incrementable,CategoryOrTraversal,Difference>::distance_to(const
boost::counting_iterator<OtherIncrementable> &) const' : could not deduce
template argument for 'const boost::counting_iterator<OtherIncrementable> &'
from 'const
boost::counting_iterator<Incrementable,CategoryOrTraversal,Difference>'

My question is why limiting the last three template parameters to default in
counting_iterator::distance_to.

Thanks,

Sean


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