Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-01-11 22:31:33


"Paul Mensonides" <pmenso57_at_[hidden]> writes:

> ----- Original Message -----
> From: "David Abrahams" <dave_at_[hidden]>
>
>
>> "Paul Mensonides" <pmenso57_at_[hidden]> writes:
>>
>> >> > Well, yes. If you do that, however, it removes one of the primary
>> > reasons
>> >> > to use enumerations, which is for the syntactic convenience. The
> only
>> >> > reason left to use enums is to avoid the static storage of the
>> >> > values.
>> >>
>> >> And to improve compilation and linking speed.
>>
>> I haven't done the tests of course, but I'd expect it to be faster
>> anyway. Allocating space in the link map for the static constant and
>> resolving it across translation units has to cost something.
>
> I guess it would depend heavily on the compiler used. For instance, a
> compiler might not actually create the storage at all unless the address of
> the static const is actually needed--which would cause the effect to be
> minimal. On the other hand, unless you mapped all the enumerators of a
> particular value to the same type, you'd have issues with name lookup.

My proposal with integral_c would do exactly that.

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