std::tuple_element<div class="t-tr-text"><std::tuple><div class="t-tr-dropdown"><div><div><div class="t-tr-dropdown-arrow-border"></div><div class="t-tr-dropdown-arrow"></div><div class="t-tr-dropdown-h">原文:</div><div class="t-tr-dropdown-orig"><std::tuple></div><div class="t-tr-dropdown-notes">这段文字是通过 [http://translate.google.com Google Translate] 自动翻译生成的。<br/>您可以帮助我们检查、纠正翻译中的错误。详情请点击[http://en.cppreference.com/w/Cppreference:MachineTranslations 这里]。</div></div></div></div></div>
来自cppreference.com
![]() |
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
在头文件 <tuple> 中定义
|
||
template< std::size_t I, class T > class tuple_element; /* undefined */ |
(1) | (C++11 起) |
template< std::size_t I, class... Types > class tuple_element< I, tuple<Types...> >; |
(2) | (C++11 起) |
template< std::size_t I, class T > class tuple_element< I, const T > { |
(3) | (C++11 起) |
template< std::size_t I, class T > class tuple_element< I, volatile T > { |
(4) | (C++11 起) |
template< size_t I, class T > class tuple_element< I, const volatile T > { |
(5) | (C++11 起) |
编译型索引访问提供的元组中的元素的类型.
原文:
Provides compile-type indexed access to the types of the elements of the tuple.
目录 |
[编辑] 会员类型
会员类型
|
Definition |
type | I th元素的元组,其中I 在[0, sizeof...(Types)) 类型 原文: the type of I th element of the tuple, where I is in [0, sizeof...(Types)) |
[编辑] 可能的实现
template< std::size_t I, class T > struct tuple_element; // recursive case template<std::size_t I, class Head, class... Tail > struct tuple_element<I, std::tuple<Head, Tail...>> : std::tuple_element<I-1, std::tuple<Tail...>> { }; // base case template< class Head, class... Tail > struct tuple_element<0, std::tuple<Head, Tail...>> { typedef Head type; }; |
[编辑] 示例
本章尚未完成 原因:暂无示例 |
[编辑] 另请参阅
array 的元素获得的类型 原文: obtains the type of the elements of array (类模板特化) | |
获得pair 中元素的类型 (类模板特化) |