Boost logo

Boost :

From: DY, JERRY U \(SBCSI\) (jd2419_at_[hidden])
Date: 2004-07-21 18:08:07


I'm troubleshooting counting_iterator_test.hpp. In particular:

FILE: counting_iterator_test.cpp
class my_int2 {
public:
        ...
        typedef std::bidirectional_iterator_tag iterator_category;
};

FILE: counting_iterator.hpp

template <class Incrementable, class CategoryOrTraversal, class
Difference>
struct counting_iterator_base {
      typedef typename detail::ia_dflt_help<
          CategoryOrTraversal
        , mpl::apply_if<
              is_numeric<Incrementable>
            , mpl::identity<random_access_traversal_tag>
            , iterator_traversal<Incrementable>
>
>::type traversal;

...
}

The class my_int2 is passed as parameter "Incrementable" to
counting_iterator_base, but is failing the is_numeric test so my_int2 is
just a bidirectional iterator (see mpl::apply_if above). If it passes
the is_numeric test, then it's a random access traversal tag. The way it
passes the is_numeric test is to specialize std::numeric_limits like so:

template <> class std::numeric_limits<my_int2> {
public:
        static bool const is_specialized = false;
};

But I don't find that in the source. It appears that aC++ doing the
right thing, but I know I'm wrong. Could somebody please help?? Thanks!

-Jerry


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk