Boost logo

Boost :

From: scleary_at_[hidden]
Date: 2003-01-09 16:33:57


> You would have to have more than one "map_integral" with a different value
> name, where the values are dependent on one another and are part of the
> public interface. It isn't a complete solution, but it does work in most
> cases.

For future metaprogramming work (or intermediate values), it might be nice
to add a tag class to map_integral (default it to 'void' for the common
case), and define a BOOST_NEW_STATIC_CONSTANT(type, name, val) which expands
to:
  struct name { enum { value = (val); }; }
for enum-based compilers, and:
  struct boost__secret_ ## name { };
  typedef ::boost::map_integral<type, (val), boost__secret_ ## name> name
for static-const-based compilers.

The idea being that what once was referred to as "T::name" would now become
"T::name::value"

This solution is nice because it takes care of automatic definitions of any
number of compile-time values, but it is sadly non-backwards-compatible. :(

        -Steve


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