名稱空間
變體
操作

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

來自 cppreference.com
< cpp‎ | 工具庫‎ | 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)

[編輯] 示例

[編輯] 參閱

如果存在則返回意外值,否則返回另一個值
(public member function) [編輯]
訪問預期值
(public member function) [編輯]
返回預期值
(public member function) [編輯]
檢查物件是否包含預期值
(public member function) [編輯]