Megosztás a következőn keresztül:


tuple_element Class <array>

Wraps the type of an array element.

template<int Idx, class Ty, std::size_t N>
class tuple_element<Idx, <array<Ty, N> > {
    typedef Ty type;
    };

Template Parameters

  • Idx
    The element offset.

  • Ty
    The type of an element.

  • N
    The size of the array.

Remarks

This template class is a specialization of the template class tuple_element Class <tuple>. It has a nested typedef type that is a synonym for the type of the Idx element of the array.

Example

 

// 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); 
    } 
 
 0 1 2 3
 0

Requirements

Header: <array>

Namespace: std

See Also

Reference

<array>

<tuple>

tuple_element Class <tuple>