Namespaces
Variants

std::execution:: just_error

From cppreference.net
定义于头文件 <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 类类型的常量函数对象。其类型的 cv 非限定版本是一个标记类型,表示为 execution::just_error_t 。有关详细信息,请参阅 定制点对象

注释

如果提供的错误是左值引用,将在返回的发送器内部创建副本,并向接收器的 set_error 传递该副本的非const左值引用。如果提供的值是右值引用,则会将其移动至返回的发送器中,并向接收器的 set_error 传递其右值引用。

示例