Boost logo

Boost :

From: Frank Laub (frank.laub_at_[hidden])
Date: 2005-12-08 20:15:29

> Frank Laub wrote:
> >>As a related issue, it might be good to have the a similar struture
> >>which you can use to map from the enum value to the string value and
> >>vice versa. This runtime mapping should not require any heap-allocations
> .
> > values to be sequential from 0. This is where I want to go with
> > BOOST_ENUM_VALUES(). It would require an extra column of data where the
> user
> > would put their value portion. Then I could construct a map just as you
> are
> > describing.
> You kinda already have the values because the enumeration starts with
> value 0 and then increments each new item. Of course it would be
> nice/necessary to be able to specify the value if the defaults are not
> what one wants.
Ya, that's the trick I'm looking for, I want users to be able to do:
enum Foo { a = 0x10, b = 0x20 };
In this case I need a map because I can't assume that the value they want me
to parse is an index in the enum. That's why I'm thinking I could add
another column of sequences to provide this information.

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