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" <[EMAIL PROTECTED]> wrote in message
asg0jo$mf4$[EMAIL PROTECTED]">news:asg0jo$mf4$[EMAIL PROTECTED]...
> "Johan Nilsson" <[EMAIL PROTECTED]> wrote in message
> asf9bt$7g6$[EMAIL PROTECTED]">news:asf9bt$7g6$[EMAIL PROTECTED]...
> > [...]
> > 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
>




_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to