Boost logo

Boost :

From: Giovanni P. Deretta (lordshoo_at_[hidden])
Date: 2005-04-27 11:16:32


... replying to myself

Giovanni P. Deretta wrote:
> Larry Evans wrote:
>>
>> But it wouldn't work for repeated types, unless, as you
>> noted previously, some sort of "tag" were "associated" with
>> the type, which is what an mpl::map does, only it assures there's
>> only one type associated with each tag; whereas the example:
>>

I couldn't parse this paragraph correctly the first time, the second
time i *thought* i did get it. The third time i *did* get it, but i had
already sent my reply... :)

> I think i failed to expain this,
> from your next example i think you thought that my extended_tuple where
> some sort of mpl-like container.

It was me that didn't understand. You are right, a map is better.

>
> Well, in my extended tuple example tags are _not_ associated with a
> tuple. Different tuples can reuse the same tag set or part of it.
> This is very useful for generic programming, for example, i may have a
> function that accept a tuple having a some_tag slot. Doing this 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 forced to use
> the enum ordering. Anyway, i don't think you proposed to reuse the same
> enums, only the names, but then you are forced to write enums for every
> tuple.
> Anyway, I think i will try fusion now :)
>
This still stand.

--
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