std::ignore
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. |
<metanoindex/>
<tbody> </tbody>| Elemento definito nell'header <tuple>
|
||
const /*unspecified*/ ignore; |
(dal C++11) | |
Un oggetto di tipo non specificato in modo tale che qualsiasi valore È possibile assegnare ad essa senza alcun effetto. utilizzare insieme std::tie durante la rimozione di un std::tuple, come segnaposto per gli argomenti che non vengono utilizzati.
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.
You can help to correct and verify the translation. Click here for instructions.
Esempio
decomprimere una coppia restituita da set.insert (), ma solo salvare il boolean .
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.
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";
}
}
Output:
Value was inserted sucessfully
crea un tuple di riferimenti lvalue o spacchetta una tupla in singoli oggettiOriginal: creates a tuple of lvalue references or unpacks a tuple into individual objectsThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (funzione di modello) |