Boost logo

Boost :

From: David B. Held (dheld_at_[hidden])
Date: 2002-12-02 11:12:16


"Johan Nilsson" <johan.nilsson_at_[hidden]> wrote in message
news:asf9bt$7g6$1_at_main.gmane.org...
> [...]
> enum Colors
> {
> Red = 1,
> Blue = 2
> };
>
> struct ColorTable
> : public StaticLookupTable<ColorTable, Colors, std::string>
> {
> LOOKUP_TABLE_BEGIN()
> LOOKUP_ENTRY(Red, "Red")
> LOOKUP_ENTRY(Blue, "Blue")
> LOOKUP_TABLE_END()
> };
> [...]

This looks like something that could/should go into a smart enum library.
The ability to map strings to enums seems common enough (and is just as
important to me as iterating over an enum type).

Dave


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