Boost logo

Boost Users :

From: Stephen Gross (sgross_at_[hidden])
Date: 2005-04-08 09:49:51


To review:

> When including "boost/iterator/indirect_iterator.hpp", I get:
>
> "/usr/local/sagedev/apis/include/boost_1_32_0/boost/detail/is_incrementable.hpp",
> line 56: error:
>
> expression must have arithmetic, enum, or pointer type
>
> BOOST_STATIC_CONSTANT(
> ^

Some new thoughts upon investigation:

It is not in the BOOST_STATIC_CAST. Doing manual compiler preprocessing
has resulted in the following code, which is what the compiler is
complaining about:

  template <class T>
  struct impl
  {
      static typename remove_cv<T>::type& x;

      static const bool value = sizeof(is_incrementable_::check(++x,0)) ==
1;
  };

The problem is the ++x, not the static cast. The problem seems to be a
question of that x variable.

If I replace the typename of x with, say int&, it works with one
additional modification (see below), and if I replace it with a
non-incrementable object, say 'foo', that also works. My theory was it
might be in the remove_cv, but replacing the type with T& does not
work. We still get the 'must be of XXX' type message despite T being
known to be a type.

So, it would seem to be something about the templates. I'm stuck at
this point.

What I had to do to make known types work:

With known types (int, foo), the compile only works when I add an
additional set of parentheses around the ++x,0 in the check. I assume
this is an order of evaluations thing, to make certain the comma
operator is processed before the check function, which since all
versions of check are single argument, I assume is the intent here.

--Steve (sgross_at_[hidden])


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