Difference between revisions of "cpp/utility/expected/unexpect t"
From cppreference.com
(+ page for std::unexpect_t, std::unexpect) |
m (~) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 4: | Line 4: | ||
{{dcl begin}} | {{dcl begin}} | ||
{{dcl header|expected}} | {{dcl header|expected}} | ||
− | {{dcl | num=1 | since=c++23 | 1= | + | {{dcl|num=1|since=c++23|1= |
− | struct unexpect_t { | + | struct unexpect_t { explicit unexpect_t() = default; }; |
− | + | ||
− | }; | + | |
}} | }} | ||
− | {{dcl | num=2 | since=c++23 | 1= | + | {{dcl|num=2|since=c++23|1= |
− | inline constexpr unexpect_t unexpect{}; | + | inline constexpr std::unexpect_t unexpect{}; |
}} | }} | ||
{{dcl end}} | {{dcl end}} | ||
Line 16: | Line 14: | ||
@1@ A tag type for in-place construction of an unexpected value in an {{tt|std::expected}} object. | @1@ A tag type for in-place construction of an unexpected value in an {{tt|std::expected}} object. | ||
− | @2@ A constant of type {{c|const std::unexpect_t}} which is usually directly passed to a constructor of {{tt|std::expected}} to construct an unexpected value. | + | @2@ A constant of type {{c/core|const std::unexpect_t}} which is usually directly passed to a constructor of {{tt|std::expected}} to construct an unexpected value. |
===Notes=== | ===Notes=== | ||
− | Like other construction tag types, {{tt|unexpect_t}} is a trivial, empty class with an | + | Like other construction tag types, {{tt|unexpect_t}} is a trivial, empty class with an explicit default constructor. |
===See also=== | ===See also=== | ||
{{dsc begin}} | {{dsc begin}} | ||
− | {{dsc inc | cpp/utility/expected/dsc constructor}} | + | {{dsc inc|cpp/utility/expected/dsc constructor}} |
+ | {{dsc inc|cpp/utility/dsc in_place}} | ||
{{dsc end}} | {{dsc end}} | ||
{{langlinks|de|es|fr|it|ja|pt|ru|zh}} | {{langlinks|de|es|fr|it|ja|pt|ru|zh}} |
Latest revision as of 05:01, 3 November 2024
Defined in header <expected>
|
||
struct unexpect_t { explicit unexpect_t() = default; }; |
(1) | (since C++23) |
inline constexpr std::unexpect_t unexpect{}; |
(2) | (since C++23) |
1) A tag type for in-place construction of an unexpected value in an
std::expected
object.2) A constant of type const std::unexpect_t which is usually directly passed to a constructor of
std::expected
to construct an unexpected value.[edit] Notes
Like other construction tag types, unexpect_t
is a trivial, empty class with an explicit default constructor.
[edit] See also
constructs the expected object (public member function) | |
in-place construction tag (tag) |