std::execution::then
来自cppreference.com
< cpp | experimental | execution
在标头 <experimental/execution> 定义
|
||
execution::sender auto then( execution::sender auto input, |
(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 描述 pred 所描述的工作 // 随后打印 pred 所发送的全部值