|
Boost : |
From: Larry Evans (cppljevans_at_[hidden])
Date: 2005-04-27 16:02:41
Replying to self:
On 04/27/2005 11:54 AM, Larry Evans wrote:
[snip]
>>> with enum is clumsy and not type safe. I.e. a tuple might not map
>>> the whole enum set enum {a, b, c}, but get<a>(tuple_foo) would still
>>> compile even if 'a' is not logically part of tuple_foo. Also you are
>
>
> If you've defined the enum and map together, e.g. in the enum_map<i>
> structure, and used them together in enum_mapped, as shown here:
>
> http://boost-sandbox.sourceforge.net/vault/index.php?&direction=0&order=&directory=cppljevans
>
OOPS. Maybe you meant that although there were, e.g. 3 enumerators in
the enumeration, the map was only defined for 2 or 1 or none. To be
concrete, an example would be where enum_map<0> in the above vault code
were:
template
<
>
struct
enum_map
< 0
>
{
enum
field_names
{ f_0
, f_1
, f_2
};
template<field_names FieldName>
struct
field_name
{};
typedef
mpl::map
< mpl::pair<field_name<f_0>, type_i<0> >
>
field_map
;
};
then I can see your point about "tuple might not map
the whole enum set".
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk