名稱空間
變體
操作

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

[edit] 引數

input - 當發生錯誤時,將錯誤傳送給函式的傳送者
function - 可呼叫物件,在 input sender 發生錯誤時被呼叫,處理錯誤。

[edit] 返回值

返回一個傳送者,它描述了由 `input` 傳送者描述的任務圖,並添加了一個節點,該節點在發生錯誤時,將 `input` 傳送者傳送的錯誤作為引數呼叫提供的函式。

[edit] 示例