Boost logo

Boost :

From: Joel de Guzman (joel_at_[hidden])
Date: 2006-12-14 17:55:32


Larry Evans wrote:
> On 12/14/2006 08:52 AM, Thorsten Ottosen wrote:
> [snip]
>> I have used tuples in a similar manner, but I kinda think its not the
>> best to do; a named tuple would be more appropriate, or maybe just a struct.
>>
>> What bothers me is the self-explanatory properties are lost; I can't
>> figure out what tuple element that means what by just looking at the
>> code. Is it
>>
>> tie(eval,dev1,dev2) = find_root(...)
>>
>> or
>>
>> tie(dev1,dev2,eval) = find_root(...)
>>
>> ?
>>
> This "named tuple" is essentially the composite_product whose test
> code is here:
>
> http://boost.cvs.sourceforge.net/boost-sandbox/boost-sandbox/libs/indexed_types/test/composite_product_test.cpp
>
> Instead of field names, numerators in an enumeration are used. For
> example, in the above test, the numerators, {a,b,c} of the enumeration,
> indices, correspond to the field names in the following struct:
>
> struct
> r_struct
> {
> field_ndx<a> a_field;
> field_ndx<b> b_field;
> field_ndx<c> c_field;
> };

Looks very similar to the fusion map except for the use of enum
tags. Enums are not good as tags because you have to close them;
they are not open to extension.

Regards,

-- 
Joel de Guzman
http://www.boost-consulting.com
http://spirit.sf.net

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