命名空间
变体
操作

std::expected<T,E>::error

来自 cppreference.cn
< cpp‎ | utility‎ | expected
 
 
 
 
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) unex
3,4) std::move(unex)

[编辑] 示例

[编辑] 参见

如果存在非预期值则返回它,否则返回另一个值
(公共成员函数) [编辑]
访问预期值
(公共成员函数) [编辑]
返回预期值
(公共成员函数) [编辑]
检查对象是否包含预期值
(公共成员函数) [编辑]