0

std::pair 有嵌套的 typedefs first_type 和 second_type 分别给出第一个和第二个元素的类型。

但是有什么方法可以静态确定 boost::tuple (或 C++0x 中的 std::tuple )中第 N 个元素的类型?我知道我可以使用 N 作为参数创建自己的模板,并使用它递归遍历元组的 cons 列表,但是有标准的方法吗?

4

1 回答 1

1

http://www.boost.org/doc/libs/1_40_0/libs/tuple/doc/tuple_advanced_interface.html

在 C++0x 中,它的工作方式类似。但我认为它已重命名为 tuple_element<I,T>::type

于 2009-10-11T09:51:04.623 回答