|
Boost : |
From: Johan Nilsson (johan.nilsson_at_[hidden])
Date: 2002-12-04 02:32:29
Well,
if anyone's interested, tell me. This version simply implements a linear
search, but for me this has been sufficient as I generally only got so many
items in a table. Also, it only works for a one-to-one mapping (in both
directions).
// Johan
"David B. Held" <dheld_at_[hidden]> wrote in message
news:asg0jo$mf4$1_at_main.gmane.org...
> "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
>
>
>
>
> _______________________________________________
> Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk