Boost logo

Boost :

Subject: Re: [boost] [C++0x] Emulation of scoped enums
From: Matt Calabrese (rivorus_at_[hidden])
Date: 2009-03-05 19:26:26

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

-Matt Calabrese

Boost list run by bdawes at, gregod at, cpdaniel at, john at