std::monostate
From cppreference.com
Defined in header
<variant>
|
||
struct monostate { }
|
(since C++17) | |
Unit type intended for use as a well-behaved empty alternative in std::variant. In particular, a variant of non-default-constructible types may list std::monostate
as its first alternative: this makes the variant itself default-contructible.
Contents |
[edit] Member functions
(constructor)
(implicitly declared)
|
trivial implicit default/copy/move constructor (public member function) |
(destructor)
(implicitly declared)
|
trivial implicit destructor (public member function) |
operator=
(implicitly declared)
|
trivial implicit copy/move assignment (public member function) |
[edit] Non-member functions
constexpr bool operator<(monostate, monostate) noexcept { return false; }
constexpr bool operator>(monostate, monostate) noexcept { return false; } |
||
All instances of std::monostate
compare equal.
Exceptions
noexcept specification:
noexcept
[edit] Helper classes
std::hash<std::monostate>
template <> struct std::hash<monostate>;
|
||
Specializes the std::hash algorithm for std::monostate
[edit] Example
This section is incomplete Reason: no example |
[edit] See also
constructs the variant object (public member function) |