std::execution::just_error

出自cppreference.com
< cpp‎ | execution
 
 
 
在標頭 <execution> 定義
inline constexpr just_error_t just_error{};
struct just_error_t { /* 未指明 */ };
(C++26 起)
(定製點對象)
調用簽名
execution::sender auto just_error( auto&& error );
(C++26 起)

發送器工廠,它返回的發送器在接收器的 set_error() 被調用時立即完成。

e 為子表達式,代表將會被接收器拒絕並返回的輸入錯誤。表達式 just_error(e) 表達式等價/*make-sender*/(just_error, /*product-type*/(e))

定製點對象

名字 execution::just_error 代表一個定製點對象,它是某個字面 semiregular 類類型的 const 函數對象。它的類型的無 cv 限定版本是一種標籤類型,由 execution::just_error_t 表示。 細節參見定製點對象 (CustomizationPointObject)

[編輯] 註解

如果所提供的錯誤是左值引用,則在所返回的發送器中做出一個副本,並向接收器的 set_error 發送到該副本的非 const 左值引用。如果所提供的值是右值引用,則將它移動到所返回的發送器中,並向接收器的 set_error 發送到它的右值引用。

[編輯] 示例