Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2005-06-17 11:22:44


On 06/17/2005 10:47 AM, Maksym Motornyy wrote:
> Hello, all.
>
> I want to propose typesafe enums. Sources are available in Boost Sandbox
> (typesafe_enums.zip). Were tested under VC 7.1.
>
> Main features are:
> - type safety;
> - meaningful printable names;
I find this very useful.
> - ability to use in switch-case constructs;
> - iteration through enumerators;
Something similar has been proposed on the MPL to do list:

http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?MPL_TODO_List

search for "don't work with enumeration types:"

Example code is at:

http://boost-sandbox.sourceforge.net/vault/index.php?&direction=0&order=&directory=cppljevans/mpl

in range_all.zip. If your enumerators can be used to make tuples or
variants with "named" fields, as done in the:

   cppljevans/tuple_nested_enum_test.cpp

in the vault, I'd be interested.


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