namespace std::execution {
struct let_stopped_t { unspecified };
inline constexpr let_stopped_t let_stopped{};
}
概要
let_stopped
は、新しいSenderを返す関数呼び出し可能なオブジェクトに引き渡すことで、入力Senderの停止完了結果から入れ子の非同期操作へと変換するSenderアダプタである。
let_stopped
はパイプ可能Senderアダプタオブジェクトであり、パイプライン記法をサポートする。
Senderアルゴリズムlet_stopped
の仕様は、let_value
ページを参照のこと。
例
#include <print>
#include <execution>
namespace ex = std::execution;
int main()
{
{ // 関数呼び出し
ex::sender auto snd0 = ex::just_stopped();
ex::sender auto snd1 = ex::let_stopped(
snd0,
[]() -> ex::sender auto {
return ex::just(42);
});
auto [val] = std::this_thread::sync_wait(snd1).value();
std::println("{}", val);
}
{ // パイプライン記法
ex::sender auto sndr = ex::just_stopped()
| ex::let_stopped(
[]() -> ex::sender auto {
return ex::just(42);
});
auto [val] = std::this_thread::sync_wait(sndr).value();
std::println("{}", val);
}
}
出力
42
42
バージョン
言語
- C++26
処理系
- Clang: ??
- GCC: ??
- ICC: ??
- Visual C++: ??