std::get(std::array)
De cppreference.com
[] |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
<metanoindex/>
<tbody> </tbody> template<size_t I, class T, size_t N > T& get( array<T,N>& a ); |
(1) | (depuis C++11) |
template<size_t I, class T, size_t N > T&& get( array<T,N>&& a ); |
(2) | (depuis C++11) |
template<size_t I, class T, size_t N > const T& get( const array<T,N>& a ); |
(3) | (depuis C++11) |
Extraits de l'lment element
Ith partir du tableau . Original:
Extracts the
Ith element element from the array. The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
I doit tre une valeur entire dans [0, N) gamme. Ceci est renforc lors de la compilation plutt que at() ou operator[]() .Original:
I must be an integer value in range [0, N). This is enforced at compile time as opposed to at() or operator[]().The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Paramtres
| a | - | tableau dont le contenu extraire
Original: array whose contents to extract The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Retourne la valeur
1)
Rfrence l'lment de
Ith a .Original:
Reference to the
Ith element of a.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
2)
Rvalue rfrence l'lment de
Ith a, sauf si l'lment est de type rfrence lvalue, auquel cas lvalue rfrence est renvoy .Original:
Rvalue reference to the
Ith element of a, unless the element is of lvalue reference type, in which case lvalue reference is returned.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
3)
Rfrence const l'lment de
Ith a .Original:
Const reference to the
Ith element of a.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Exceptions
Exemple
#include <iostream>
#include <array>
int main()
{
std::array<int, 3> arr;
// set values:
std::get<0>(arr) = 1;
std::get<1>(arr) = 2;
std::get<2>(arr) = 3;
// get values:
std::cout << "(" << std::get<0>(arr) << ", " << std::get<1>(arr)
<< ", " << std::get<2>(arr) << ")\n";
}
Rsultat :
(1, 2, 3)
Voir aussi
| accde l'lment spcifi (fonction membre publique) | |
| accde l'lment spcifi avec vrification de bornes (fonction membre publique) | |
tuple accde lment spcifi Original: tuple accesses specified element The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction gnrique) | |
(C++11) |
accde un lment d'un pair Original: accesses an element of a pair The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction gnrique) |