std::execution::then
來自 cppreference.com
定義於標頭檔案 <execution> |
||
execution::sender auto then( execution::sender auto input, std::invocable</*values-sent-by*/(input)...> function ); |
(C++26 起) | |
[編輯] 引數
input | - | 傳送者,一旦執行便傳送函式執行所需的值 |
function | - | 可呼叫物件,由連結到輸入傳送者的新發送者呼叫 |
[編輯] 返回值
返回一個傳送者,它描述了由輸入傳送者描述的任務圖,並添加了一個節點,用於使用輸入傳送者傳送的值作為引數呼叫所提供的函式。
保證在返回的傳送者啟動之前,`then` 不會開始執行函式。
[編輯] 示例
execution::then
的可能用法。
execution::sender auto input = get_input(); execution::sender auto snd = execution::then(input, [](auto... args) { std::print(args...); }); // snd describes the work described by pred // followed by printing all of the values sent by pred