tags:

views:

147

answers:

1

std::pair has the nested typedefs first_type and second_type which give the type of the first and second element respectively.

But is there any way to statically determine the type of the Nth element in a boost::tuple (or std::tuple in C++0x)? I know I could create my own template with N as a parameter, and use it to recursively traverse the cons list of the tuple, but is there a standard way of doing this?

+1  A: 

http://www.boost.org/doc/libs/1%5F40%5F0/libs/tuple/doc/tuple%5Fadvanced%5Finterface.html

In C++0x it will work similarly. But I think it has been renamed to tuple_element<I,T>::type

sellibitze