Boost logo

Boost :

Subject: Re: [boost] [C++0x] Emulation of scoped enums
From: Kjell Elster (kjell_elster_at_[hidden])
Date: 2009-03-05 10:45:37


I like it, iff you change the implementation from

#ifndef BOOST_NO_SCOPED_ENUMS
...

to

#ifdef BOOST_NO_SCOPED_ENUMS

I do have a hard time with double negations.

Kjell E

> Date: Thu, 5 Mar 2009 10:37:12 -0500
> From: bdawes_at_[hidden]
> To: boost_at_[hidden]
> Subject: [boost] [C++0x] Emulation of scoped enums
>
> The improved type safety of the C++0x scoped enum feature is attractive,
> so I'd like to start using it as it becomes available in compilers.
>
> See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf
> for a description. Note that the committee changed the name from
> strongly typed enums to scoped enums.
>
> See the attached for a boost/detail header that provides macro wrappers
> that use scoped enums if available, otherwise fall back on C++03
> namespaces and unscoped enums. It lets a library write:
>
> BOOST_SCOPED_ENUM_START(algae) { green, red, cyan };
> BOOST_SCOPED_ENUM_END
> ...
> BOOST_SCOPED_ENUM(algae) sample( algae::red );
> void func(BOOST_SCOPED_ENUM(algae));
>
> and then a user can write:
>
> sample = algae::green;
> func( algae::cyan );
>
> Comments or suggestions appreciated,
>
> --Beman
>

_________________________________________________________________
Dela foton på ett smidigt sätt med Windows Live™ Photos.
http://www.microsoft.com/windows/windowslive/products/photos.aspx


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