Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2005-04-27 13:36:12


On 04/27/2005 01:06 PM, Larry Evans wrote:
[snip]
> Anyway, I should say, w.r.t. redundancy, that the following code:
However, with respect to your desire for using a template member
function:

    template<class FieldType>
       FieldType&
    get()
    ;

to get some field in the tuple of type, FieldType, this can easily be
done with a slight modification of the code for tuple_indexed
in the vault:

    template<class FieldType>
       FieldType&
    get()
    {
       typedef find<Values,FieldType>::type pos;
       typedef distance<pos,front<Values> >::type offset;
       Indices const index=Indices(offset::value);
       return get<index>();
    }


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