Espaços nominais
Variantes
Acções

std::get(std::tuple)

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

 
 
Biblioteca de utilitários
Digite apoio (basic types, RTTI, type traits)
Gerenciamento de memória dinâmica
De tratamento de erros
Utilidades do programa
Variadic funções
Data e hora
Objetos de função
(C++11)
Os operadores relacionais
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>=
Pares e tuplas
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.
(C++11)
Troque, avançar e avançar
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.
(C++11)
(C++11)
(C++11)
 
std::tuple
Funções de membro
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.
tuple::tuple
tuple::operator=
tuple::swap
Não-membros funções
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.
get
Classes auxiliares
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.
 
template< std::size_t I, class... Types >

typename std::tuple_element<I, tuple<Types...> >::type&

    get( tuple<Types...>& t );
(1)(desde C++11)
template< std::size_t I, class... Types >

typename std::tuple_element<I, tuple<Types...> >::type&&

    get( tuple<Types...>&& t );
(2)(desde C++11)
template< std::size_t I, class... Types >

typename std::tuple_element<I, tuple<Types...> >::type const&

    get( const tuple<Types...>& t );
(3)(desde C++11)
Extrai o elemento elemento Ith da tupla. I é um valor inteiro em [0, sizeof...(Types)).
Original:
Extracts the Ith element element from the tuple. I is an integer value in [0, sizeof...(Types)).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Índice

[editar] Parâmetros

t-
tupla cujo conteúdo para extrair
Original:
tuple 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.

[editar] Valor de retorno

1)
Referência para o elemento de Ith t.
Original:
Reference to the Ith element of t.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
Rvalue referência para o elemento de Ith t, a menos que o elemento é de lvalue tipo de referência, neste caso, é devolvido lvalue referência.
Original:
Rvalue reference to the Ith element of t, 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.
3)
Const referência ao elemento Ith de t.
Original:
Const reference to the Ith element of t.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Exceções

noexcept specification:  
noexcept
  (desde C++11)

[editar] Exemplo

#include <iostream>
#include <string>
#include <tuple>
 
int main()
{
    auto t = std::make_tuple(1, "Foo", 3.14);
    std::cout << "(" << std::get<0>(t) << ", " << std::get<1>(t)
              << ", " << std::get<2>(t) << ")\n";
}

Saída:

(1, Foo, 3.14)

[editar] Veja também

accesses an element of an array
(modelo de função) [edit]
acede a um elemento de um 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.

(modelo de função) [edit]