Subject: Re: [boost] Scoped Enum Emulation
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2012-01-25 16:27:13
Le 25/01/12 02:40, Joshua Boyce a écrit :
> On Wed, Jan 25, 2012 at 9:17 AM, Vicente J. Botet Escriba<
> vicente.botet_at_[hidden]> wrote:
>> While this is not yet a complete emulation of scoped enums, it has the
>> advantage of that there is no need to use a macro to name the strong type.
>> I don't know if it will be confusing to put provide both approaches in a
>> single mini library.
> Out of curiosity, what are the cons of this implementation compared to the
> existing one? (The pros seem fairly obvious, but I think I'm missing the
Respect to the Beman approach, the major downside I can see is that a
strong enum is not always and enumeration, so cannot be used in a
portable way where an enum is expected (e.g. switch, ...).
Something else is needed to be able to write portable code.
In addition, not all c++ compilers provide explicit conversion, so
either we need to use a explicit function to convert to the underlying
type or let the underlying type conversion operator implicit.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk