std::ignore (3) - Linux Manuals
std::ignore: std::ignore
Command to display std::ignore
manual in Linux: $ man 3 std::ignore
NAME
std::ignore - std::ignore
Synopsis
Defined in header <tuple>
const /*unspecified*/ ignore; (since C++11)
(until C++17)
inline constexpr /*unspecified*/ ignore; (since C++17)
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.
// Run this code
#include <iostream>
#include <string>
#include <set>
#include <tuple>
int main()
{
std::set<std::string> set_of_str;
bool inserted = false;
std::tie(std::ignore, inserted) = set_of_str.insert("Test");
if (inserted) {
std::cout << "Value was inserted successfully\n";
}
}
Output:
Value was inserted successfully
See also
creates a tuple of lvalue references or unpacks a tuple into individual objects
tie (function template)
Pages related to std::ignore
- std::identity (3) - std::identity
- std::ifstream (3) - std::basic_ifstream
- std::ilogb,std::ilogbf,std::ilogbl (3) - std::ilogb,std::ilogbf,std::ilogbl
- std::imag(std::complex) (3) - std::imag(std::complex)
- std::in_place,std::in_place_type,std::in_place_index,std::in_place_t, (3) - std::in_place,std::in_place_type,std::in_place_index,std::in_place_t,
- std::in_place,std::in_place_type,std::in_place_index,std::in_place_t,std::in_place_type_t,std::in_place_index_t (3) - std::in_place,std::in_place_type,std::in_place_index,std::in_place_t,std::in_place_type_t,std::in_place_index_t
- std::includes (3) - std::includes
- std::inclusive_scan (3) - std::inclusive_scan
- std::incrementable_traits (3) - std::incrementable_traits
- std::independent_bits_engine (3) - std::independent_bits_engine