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?
http://www.boost.org/doc/libs/1_40_0/libs/tuple/doc/tuple_advanced_interface.html
In C++0x it will work similarly. But I think it has been renamed to tuple_element<I,T>::type
精彩评论