std::execution::then
来自 cppreference.cn
定义于头文件 <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