命名空间
变体
操作

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 起)

[edit] 参数

input - 当发生错误时,将错误发送给函数的发送者
function - 可调用对象,在 input sender 发生错误时被调用,处理错误。

[edit] 返回值

返回一个发送者,它描述了由 `input` 发送者描述的任务图,并添加了一个节点,该节点在发生错误时,将 `input` 发送者发送的错误作为参数调用提供的函数。

[edit] 示例