Espacios de nombres
Variantes
Acciones

std::ignore

De cppreference.com
< cpp‎ | utility‎ | tuple
 
 
Biblioteca de servicios
 
std::tuple
Funciones miembro
Funciones no miembro
(hasta C++20)(hasta C++20)(hasta C++20)(hasta C++20)(hasta C++20)(C++20)
Guías de deducción(C++17)
Clases asistentes
ignore
 
Definido en el archivo de encabezado <tuple>
const /*unspecified*/ ignore;
(desde C++11)
Un objeto de tipo no especificado de manera que cualquier valor pueden ser asignados a ella sin efecto. Diseñado para usarse con std::tie al desempaquetar un std::tuple, como un marcador de posición para los argumentos que no se usan .
Original:
An object of unspecified type such that any value can be assigned to it with no effect. Intended for use with std::tie when unpacking a std::tuple, as a placeholder for the arguments that are not used.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Ejemplo

desempaquetar un par devuelto por set.insert (), pero sólo se ahorra el booleano .
Original:
unpack a pair returned by set.insert(), but only save the boolean.
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>
 
int main()
{
    std::set<std::string> set_of_str;
    bool inserted;
    std::tie(std::ignore, inserted) = set_of_str.insert("Test");
    if (inserted) {
        std::cout << "Value was inserted sucessfully\n";
    }
}

Salida:

Value was inserted sucessfully
Crea una tupla de referencias lvalue o desempaca una tupla en objetos individuales.
(plantilla de función) [editar]