std::get(std::array)
Da cppreference.com.
![]() | Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate. La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
template<size_t I, class T, size_t N > T& get( array<T,N>& a ); | (1) | (dal C++11) |
template<size_t I, class T, size_t N > T&& get( array<T,N>&& a ); | (2) | (dal C++11) |
template<size_t I, class T, size_t N > const T& get(const array<T,N>& a ); | (3) | (dal C++11) |
Estrae l'elemento elemento
Ith
dalla matrice. 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
deve essere un valore intero in [0, N)
gamma. Questo viene applicato in fase di compilazione in contrasto con at()
o 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.
Indice |
[modifica]Parametri
a | - | matrice i cui contenuti da estrarre 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. |
[modifica]Valore di ritorno
1)Riferimento all'elemento
2) Ith
di 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.
Rvalue riferimento all'elemento di
3) Ith
a
, a meno che l'elemento è di tipo lvalue riferimento, nel qual caso viene restituito lvalue riferimento.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.
Const riferimento all'elemento
Ith
di 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.
[modifica]Eccezioni
[modifica]Esempio
#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";}
Output:
(1, 2, 3)
[modifica]Vedi anche
accedere elemento specificato Original: access specified element The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) | |
accedere elemento specificato con verifica dei limiti Original: access specified element with bounds checking The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) | |
tupla accede elemento specificato 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. (funzione di modello) | |
(C++11) | accede a un elemento di una 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. (funzione di modello) |