Boost logo

Boost :

From: scleary_at_[hidden]
Date: 2001-02-07 09:26:11

> 3) There are problem handling integral constant expressions, in particular
> you must refer to integral constant expressions by their fully qualified
> names, otherwise they are not recognised as such (I've sporadically had
> this problem with VC6 as well).

Another workaround I've found for this problem is to surround the integral
constant expression with an extra set of parenthesis (the following code may
be a good example for your gotcha's page, John):

#include <iterator>
#include <limits>

// Purpose of struct: to resolve the "iterator" category for an iterator or
// integer (all integers are considered random access)
template <typename IntegerOrIterator, bool IsInteger>
struct int_it_category;
template <typename Integer>
struct int_it_category<Integer, true>
{ typedef std::random_access_iterator_tag tag; };
template <typename Iterator>
struct int_it_category<Iterator, false>
{ typedef typename std::iterator_traits<Iterator>::iterator_category tag; };

template <typename IntegerOrIterator>
struct int_it_traits
  // This typedef fails with "E2401 Invalid template argument list"
  typedef typename int_it_category<IntegerOrIterator,
      std::numeric_limits<IntegerOrIterator>::is_integer >::tag category;

  // This typedef succeeds
  //typedef typename int_it_category<IntegerOrIterator,
  // (std::numeric_limits<IntegerOrIterator>::is_integer) >::tag

  // So does this one
  //typedef typename int_it_category<IntegerOrIterator,
  // ::std::numeric_limits<IntegerOrIterator>::is_integer >::tag

In any case, it shouldn't be necessary to go the true_struct/false_struct


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