std::unexpect_t, std::unexpect
來自 cppreference.com
定義於標頭檔案 <expected> |
||
struct unexpect_t { explicit unexpect_t() = default; }; |
(1) | (C++23 起) |
inline constexpr std::unexpect_t unexpect{}; |
(2) | (C++23 起) |
1) 用於在
std::expected
物件中原地構造非預期值的標籤型別。2) 型別為 const std::unexpect_t 的常量,通常直接傳遞給
std::expected
的建構函式以構造非預期值。[編輯] 注意
與其他構造標籤型別一樣,unexpect_t
是一個帶有顯式預設建構函式的平凡、空類。
[編輯] 另請參閱
構造 expected 物件(公共成員函式) | |
原地構造標籤 (標籤) |