Aracılığıyla paylaş


get Function <array>

Bir başvuru verir arr[Idx].

template<int Idx, class Ty, std::size_t N>
    Ty& get(array<Ty, N>& arr);
template<int Idx, class Ty, std::size_t N>
    const Ty& get(const array<Ty, N>& arr);

Parametreler

  • Idx
    Öğe uzaklığı.

  • Ty
    Bir öğe türü.

  • N
    Dizi boyutu.

  • arr
    Seçmek için dizi.

Örnek

 

// std_tr1__array__get.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 odd elements " 1 3" 
    std::cout << " " << std::get<1>(c0); 
    std::cout << " " << std::get<3>(c0); 
    std::cout << std::endl; 
 
    return (0); 
    } 
 
  

Gereksinimler

Başlık: <array>

Namespace: std

Ayrıca bkz.

Başvuru

<array>

tuple_element Class <array>