std::expected<T,E>::error
来自 cppreference.cn
| constexpr const E& error() const& noexcept; |
(1) | (C++23 起) |
| constexpr E& error() & noexcept; |
(2) | (C++23 起) |
| constexpr const E&& error() const&& noexcept; |
(3) | (C++23 起) |
| constexpr E&& error() && noexcept; |
(4) | (C++23 起) |
访问 *this 中包含的意外值。
如果 has_value() 为 true,则行为未定义。
[编辑] 返回值
1,2)
unex3,4) std::move(
unex)[编辑] 示例
| 本节不完整 原因:无示例 |
[编辑] 参阅
| 如果存在则返回意外值,否则返回另一个值 (public member function) | |
| 访问预期值 (public member function) | |
| 返回预期值 (public member function) | |
| 检查对象是否包含预期值 (public member function) |