Boost logo

Boost :

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

Sorry... sent the original e-mail too quickly. Here's why I say that
std::numeric_limits has to be specialized and the is_specialized member
must be set to true if you want a particular type to pass the is_numeric

template <class T>
 struct is_numeric_impl
 typedef ::boost::static_assert_test<
        sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)(
::boost::is_integral<char>::value ) >)
> boost_static_assert_typedef_33 ;
 static const bool value = std::numeric_limits<T>::is_specialized ;

template <> class std::numeric_limits<my_int2> {
        static bool const is_specialized = true;


-----Original Message-----
Sent: Wednesday, July 21, 2004 4:08 PM
To: boost_at_[hidden]
Subject: counting_iterator_test.hpp fails on aC++

I'm troubleshooting counting_iterator_test.hpp. In particular:

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

FILE: counting_iterator.hpp

template <class Incrementable, class CategoryOrTraversal, class
struct counting_iterator_base {
      typedef typename detail::ia_dflt_help<
        , mpl::apply_if<
            , 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> {
        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!


Boost list run by bdawes at, gregod at, cpdaniel at, john at