Boost logo

Boost :

From: Giovanni P. Deretta (lordshoo_at_[hidden])
Date: 2005-04-27 17:33:23


Sorry for the no-op email, I don't know how it did get sent.

Larry Evans wrote:
>
>
> 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".
>

Exactly, and this is something i need (and probably is the only reason
to use some kind of tag instead of indexes). In code that i wrote there
were a set of functions that had similar effects and had multiple
return values (as tuples). The return values weren't the same, but all
of them had a common types. Some generic code had to work with this
functions and needed to extract this common types from the tuples. A
typed get was exactly what i needed. Fusion 'find' would probably have
done the job as well, but i did not know it untill now.

--
Giovanni P. Deretta
Giovanni P. Deretta

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