Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2006-12-14 11:12:35


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


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