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 发送到它的右值引用。

[编辑] 示例