Boost logo

Boost Users :

From: Philippe Mori (philippe_mori_at_[hidden])
Date: 2005-02-17 15:34:19


In C++ Template Metaprogramming book, there is the expression i::category
in tables 5.1, 5.2 and 5.3 that says that the result is convertible to
mpl::forward_iterator_tag, mpl::bidirectional_iterator_tag and
mpl::random_access_iterator_tag respectively.

Since a random access iterator is bidirectional iterator which is
in turn a forward iterator, I was expecting that i::category for
a bidirectional iterator would also be convertible to mpl::forward_tag
which is not the case.

So if an algorithm has to works differently for random-access iterator
but it the same for forward and bidirectional iterator, it seems to me
that I would need some extra logic to uses forward iterator algorithm
if I have a bidirectional iterator as theree are no implicit conversion.

In fact, in the implementation we derives from int_<n> where n is
0, 1 or 2 depending on the iterator type.

Philippe



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