Boost logo

Boost :

From: Terje Slettebø (tslettebo_at_[hidden])
Date: 2003-01-09 12:44:07


>From: "David Abrahams" <dave_at_[hidden]>

> Terje Slettebø <tslettebo_at_[hidden]> writes:
>
> > And since there are techniques for making out-of-class definitions
easier
> > (and automatic), which may be instantiated if needed, like you showed,
then
> > static const seems clearly best.
>
> That's not nearly so easy to take care of if the metafunction in
> question is something like alignment_of<T> which could potentially
> have lots of values, depending on the T chosen.

In what way would this affect Paul's suggestion:

template<class T, T V> struct map_integral {
    static const T value = V;
};

template<class T, T V> const T map_integral<T, V>::value;

By the way, this could have been done with mpl::integral_c, as well,
provided the out-of-class definition is given.

Do you maybe refer to that each value may take up space in the executable,
if used in such a way that instantiation is needed? That's right, and that's
not the case for enum. Still, there are the issues for enum, as well.

Regards,

Terje


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