Boost logo

Boost :

From: John Max Skaller (skaller_at_[hidden])
Date: 2001-06-19 16:06:14


Gary Powell wrote:
>
> Hi,
>
> [John Max Skaller]
> Let T be a tuple type.
> What is the name of the type of the n'th element?
>
> [Gary]
> It's not address' able by name per se. Instead use either the access
> function or the member function to get the nth item.

        You misunderstood. What is the name of the TYPE of the n'th element?
If I have a tuple:

        tuple<T1,T2>

then the name of the TYPE of the first element is T1. How do I get the
name,
given only the tuple type?

This may be useful in some circumstances. For example:

        template<class T> void f(T t)(
                typename T::type1 x = get<1>(t);
                typename T::type2 y = get<2>(t);
        }

There is no use being able to get the n'th element,
if you can't name its type. Often, you know, but it would
be useful to get the type in a template where the tuple is
passed as a single T.

-- 
John (Max) Skaller, mailto:skaller_at_[hidden]
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
checkout Vyper http://Vyper.sourceforge.net
download Interscript http://Interscript.sourceforge.net

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