Espacios de nombres
Variantes
Acciones

std::tie

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

 
 
Utilidades de la biblioteca
Escriba apoyo (basic types, RTTI, type traits)
Gestión de memoria dinámica
Gestión de errores
Programa de servicios públicos
Funciones variadic
Fecha y hora
Objetos Function
initializer_list(C++11)
bitset
hash(C++11)
Operadores relacionales
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 y 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.
pair
tuple(C++11)
piecewise_construct_t(C++11)
piecewise_construct(C++11)
Cambiar, hacia adelante y mover
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::tuple
Las funciones miembro
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
Terceros funciones
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_tuple
tie
forward_as_tuple
None
operator=
operator!=
operator<
operator<=
operator>
operator>=
std::swap
get
Clases de ayuda
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
tuple_element
uses_allocator
ignore
 
Defined in header <tuple>
template< class... Types >
tuple<Types&...> tie( Types&... args );
(desde C++11)
Crea una tupla de referencias lvalue a sus argumentos o instancias de std::ignore .
Original:
Creates a tuple of lvalue references to its arguments or instances of std::ignore.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Contenido

[editar] Parámetros

args -
cero o más argumentos lvalue para la construcción de la tupla
Original:
zero or more lvalue arguments to construct the tuple from
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

Un objeto que contiene referencias al respecto std::tuple lvalue .
Original:
A std::tuple object containing lvalue referenes.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Excepciones

noexcept specification:  
noexcept
  (desde C++11)

[editar] Ejemplo

std::tie se puede utilizar para introducir lexicográfico comparación con una estructura o desempaquetar una tupla:
Original:
std::tie can be used to introduce lexicographical comparison to a struct or to unpack a tuple:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

#include <iostream>
#include <string>
#include <set>
#include <tuple>
 
struct S {
    int n;
    std::string s;
    float d;
    bool operator<(const S& rhs) const
    {
        // compares n to rhs.n,
        // then s to rhs.s,
        // then d to rhs.d
        return std::tie(n, s, d) < std::tie(rhs.n, rhs.s, rhs.d);
    }
};
 
int main()
{
    std::set<S> set_of_s; // S is LessThanComparable
 
    S value{42, "Test", 3.14};
    std::set<S>::iterator iter;
    bool inserted;
    // unpacks the return value of insert into iter and inserted
    std::tie(iter, inserted) = set_of_s.insert(value);
    if(inserted)
        std::cout << "Value was inserted sucessfully\n";
}

Output:

Value was inserted sucessfully
crea un objeto tuple del tipo definido por los tipos de argumentos
Original:
creates a tuple object of the type defined by the argument types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función de plantilla) [edit]
crea un tuple de referencias rvalue
Original:
creates a tuple of rvalue references
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función de plantilla) [edit]
crea un tuple mediante la concatenación de cualquier número de tuplas
Original:
creates a tuple by concatenating any number of tuples
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función de plantilla) [edit]
marcador de posición para saltar de un elemento cuando se descomprimen usando un tuple tie
Original:
placeholder to skip an element when unpacking a tuple using tie
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(constante) [edit]