std::execution::upon_error

来自cppreference.com
< cpp‎ | execution
 
 
 
在标头 <execution> 定义
execution::sender auto  

    upon_error( execution::sender auto input,

                std::invocable</*errors-sent-by*/(input)...> function );
(C++26 起)

[编辑] 参数

input - 发送器,一旦发生错误就把错误发送给函数
function - 当输入发送器发生错误时以错误调用的可调用体

[编辑] 返回值

返回一个发送器,描述由输入发送器所描述的任务图,并添加一个节点,(当发生错误时)以输入发送器发送的错误为实参调用所提供的函数。

[编辑] 示例