Boost logo

Boost Users :

From: Sean Huang (huangsean_at_[hidden])
Date: 2006-07-18 13:29:39


From: "David Abrahams" dave_at_[hidden]

> "Sean Huang" <huangsean_at_[hidden]> writes:
>
>> My question is why limiting the last three template parameters to default
>> in
>> counting_iterator::distance_to.
>
> Sorry, I don't understand the question.
>
> The only thing that's limited here is that you can only compare
> counting iterators that have the same CategoryOrTraversal and
> Difference parameters. That might be a bit shortsighted; maybe we
> should have additional template arguments to distance_to.
Sorry, I meant the last TWO template parameters.

The distance_to is declared as:

template < class OtherIncrementable >
difference_type
distance_to(counting_iterator<OtherIncrementable > const& y) const;

My understanding is this is equivent to (correct me if I am wrong):

template < class OtherIncrementable >
difference_type
distance_to(counting_iterator<OtherIncrementable, boost::use_default,
boost::use_default > const& y) const;

To do what you want, shouldn't it be:

template < class OtherIncrementable >
difference_type
distance_to(counting_iterator<OtherIncrementable, CategoryOrTraversal,
Difference > const& y) const;

Maybe the compiler is wrong?

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