[counting_iterator] restriction/bug in distance_to()

Hi, counting_iterator.hpp defines the distance_to() member function as follows (from CVS HEAD), template <class OtherIncrementable> difference_type distance_to(counting_iterator<OtherIncrementable> const& y) const { ... Since the argument counting_iterator<OtherIncrementable> uses the default values for CategoryOrTraversal and Difference, this distance_to() template does not apply for counting_iterator's with other than the default values for CategoryOrTraversal and Difference. In particular, for a counting_iterator with non-default CategoryOrTraversal or Difference, the necessary function typedef counting_iterator<Incrementable, CategoryOrTraversal, Distance> it_type; it_type::distance_to(it_type const&) cannot be instantiated from the above template, resulting in a compile-time error. Best, Martin

Martin, Martin Weigel wrote:
Hi,
counting_iterator.hpp defines the distance_to() member function as follows (from CVS HEAD),
template <class OtherIncrementable> difference_type distance_to(counting_iterator<OtherIncrementable> const& y) const { ...
typedef counting_iterator<Incrementable, CategoryOrTraversal, Distance> it_type; it_type::distance_to(it_type const&)
cannot be instantiated from the above template, resulting in a compile-time error.
You are right I'll fix this for 1.34. Thanks Thomas -- Thomas Witt witt@acm.org
participants (2)
-
Martin Weigel
-
Thomas Witt