$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Larry Evans (cppljevans_at_[hidden])
Date: 2005-04-28 07:28:38
On 04/26/2005 05:21 PM, Joel wrote:
> Larry Evans wrote:
[snip]
>> Not if you use either something like mpl's map:
> 
> 
> [...]
> 
>>  >-------------------- cut here ---------------------
[snip]
> 
> Gentlemen, these are all variations of the associative tuple.
> An implementation of fusion's set and map will be available
> as soon as I formalize the interface. I already have an
> implementation handy, ready to be deployed.
> 
[snip]
> As to which is better: a (type) tag or an enumerator; a (type)
> tag is definitely better because 1) an enumerator fails to
> address common idioms like named parameters which uses type
OK.  I hadn't thought of that.
I'd also been wondering why there couldn't be a boost::map_c similar to
boost::vector_c whose first argument would be the integral type.  This
would avoid the need for the
   field_name
nested template in my previous post.
> tags. And, 2) a type tag can handle enumerators as well if you
> place them in some sort of enum_<enum> template akin to
> mpl::int_:
> 
>     template <my_enum e>
>     struct my_enum_ {};
> 
> IOTW, you can easily convert an enum to a type.
As was demonstrated with the
   template<enum_map_0::field_names FieldName>
   struct field_name{};
in the snipped part of my post which was quoted above ;)
BTW, changing:
[-------- cut here ---------
   template
   < class FieldTypes
   , class Indices
   >
   struct
tuple_indexed
   : factor
     < FieldTypes
     , size<FieldTypes>::value
     >
{
]-------- cut here ---------
to the following:
[-------- cut here ---------
   template
   < class FieldTypes
   , class Indices=unsigned
   >
   struct
tuple_indexed
   : tuple
     < FieldTypes
     >
{
]-------- cut here ---------
in the vault code mentioned in my previous posts would work just as
well and reuse boost::mpl::tuple or, I assume, fusion's tuple, and
achieve what OP desires, AFAICT.  If OP doesn't want to be bothered
with the enum_map arg to tuple_mapped (see vault code), he could
just use tuple_indexed<FieldTypes> (using the default Indices=unsigned).
I haven't tried it yet.