命名空间
变体
操作

std::execution::upon_error

来自 cppreference.cn
< cpp‎ | execution
 
 
 
定义于头文件 <execution>
execution::sender auto

    upon_error( execution::sender auto input,

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

[编辑] 参数

input - 发送器,当错误发生时,将错误发送给函数
function - 可调用对象,当输入发送器发生错误时,将使用错误调用它

[编辑] 返回值

返回一个发送器,描述由输入发送器描述的任务图,并添加一个节点,该节点使用输入发送器发送的错误作为参数(在发生错误的情况下)调用提供的函数。

[编辑] 示例