Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-01-09 14:53:31


Terje Slettebø <tslettebo_at_[hidden]> writes:

>>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.

Nevermind, I was not thinking straight.
I retract my remark.

-- 
                       David Abrahams
   dave_at_[hidden] * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution

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