tuple_element Class <array>
包裝陣列元素的型別。
template<int Idx, class Ty, std::size_t N>
class tuple_element<Idx, <array<Ty, N> > {
typedef Ty type;
};
Template Parameters
Idx
項目的位移。Ty
項目的型別。N
陣列的大小。
備註
這個範本類別是樣板類別 tuple_element Class <tuple>的特製化。它有 array的 Idx 項目型別的一個同義資料表的巢狀 typedef type 。
範例
// std_tr1__array__tuple_element.cpp
// compile with: /EHsc
#include <array>
#include <iostream>
typedef std::array<int, 4> Myarray;
int main()
{
Myarray c0 = {0, 1, 2, 3};
// display contents " 0 1 2 3"
for (Myarray::const_iterator it = c0.begin();
it != c0.end(); ++it)
std::cout << " " << *it;
std::cout << std::endl;
// display first element " 0"
std::tuple_element<0, Myarray>::type val = c0.front();
std::cout << " " << val;
std::cout << std::endl;
return (0);
}
需求
標題: <array>
命名空間: std