Boost logo

Boost :

Subject: Re: [boost] [C++0x] Emulation of scoped enums
From: Beman Dawes (bdawes_at_[hidden])
Date: 2009-03-11 10:47:50


On Thu, Mar 5, 2009 at 8:26 PM, Matt Calabrese <rivorus_at_[hidden]> wrote:
>>
>> I wouldn't. If you really want to use one macro only, I would use the
>> PP sequence
>> instead.
>>
>
> I'm gonna be the rebel and say that I think how it's currently implemented
> is [unfortunately] the most functional and most portable option, though I
> guess there is no harm in supplying a couple of interfaces as long as it
> doesn't make things too confusing for users. The problem with using a PP
> sequence is that you are going to hit a hard limit of 256 elements, meaning
> you have to at least support the current interface as an option otherwise
> you rule out using the macro for enums with a large number of constants.
> This also makes things frustrating for users if their enum starts below 256
> in size and then over time approaches the limit. That means they would then
> have to go back and switch from using preprocessor sequences to the original
> style interface (or use a version of Boost.Preprocessor with higher limits).
> As for using variadic macros, you need either a compiler that supports them
> as an extension for C++, or an 0x compiler. While I agree that the current
> interface is kind of ugly, I still think it's the best option available.

Good points. I agree.

--Beman


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