std::get(std::pair)

Da cppreference.com.
< cpp‎ | utility‎ | pair

 
 
Utilità libreria
Tipo di supporto (basic types, RTTI, type traits)
Gestione della memoria dinamica
La gestione degli errori
Programma di utilità
Funzioni variadic
Data e ora
Funzione oggetti
initializer_list(C++11)
bitset
hash(C++11)
Gli operatori relazionali
Original:
Relational operators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
rel_ops::operator!=
rel_ops::operator>
rel_ops::operator<=
rel_ops::operator>=
Coppie e tuple
Original:
Pairs and tuples
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
pair
tuple(C++11)
piecewise_construct_t(C++11)
piecewise_construct(C++11)
Swap, in avanti e spostare
Original:
Swap, forward and move
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
swap
forward(C++11)
move(C++11)
move_if_noexcept(C++11)
declval(C++11)
 
std::pair
Membri funzioni
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
pair::pair
pair::operator=
pair::swap
Non membri funzioni
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
make_pair
operator=
operator!=
operator<
operator<=
operator>
operator>=
std::swap
get(C++11)
Helper classi
Original:
Helper classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
tuple_size(C++11)
tuple_element(C++11)
 
template< size_t N, class T1, class T2 >

typename std::tuple_element<I, std::pair<T1,T2>>::type&

    get( pair<T1, T2>& p );
(1) (dal C++11)
template< size_t N, class T1, class T2 >

consttypename std::tuple_element<I, std::pair<T1,T2>>::type&

    get(const pair<T1,T2>& p );
(2) (dal C++11)
template< size_t N, class T1, class T2 >

typename std::tuple_element<I, std::pair<T1,T2>>::type&&

    get(std::pair<T1,T2>&& p );
(3) (dal C++11)
Estrae un elemento dalla coppia con tupla-come l'interfaccia.
Original:
Extracts a element from the pair using tuple-like interface.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Indice

[modifica]Parametri

p -
coppia il cui contenuto da estrarre
Original:
pair 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-2)
Restituisce p.first se N==0 e p.second se N==1.
Original:
Returns p.first if N==0 and p.second if N==1.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
3)
Restituisce std::forward<T1&&>(p.first) se N==0 e std::forward<T2&&>(p.second) se N==1
Original:
Returns std::forward<T1&&>(p.first) if N==0 and std::forward<T2&&>(p.second) if N==1
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifica]Eccezioni

1-3)
noexcept specification:  
noexcept
  (dal C++11)

[modifica]Esempio

#include <iostream>#include <utility>   int main(){auto p =std::make_pair(1, 3.14);std::cout<<'('<< std::get<0>(p)<<", "<< std::get<1>(p)<<')'<<std::endl;}

Output:

(1, 3.14)


[modifica]Vedi anche

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)[modifica]
accesses an element of an array
(funzione di modello)[modifica]
close