开发者

C++: Element types in a tuple

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜