Defined in header <tuple> | ||||
---|---|---|---|---|
| (since C++11) |
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.
Example
unpack a pair returned by set.insert(), but only save the boolean.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #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:
1 | Value was inserted sucessfully |
creates a tuple of lvalue references or unpacks a tuple into individual objects (function template) |
Please login to continue.