namespace std::execution {
struct set_stopped_t { unspecified }; // タグ型
inline constexpr set_stopped_t set_stopped{};
}
概要
set_stopped
は、非同期操作のキャンセル完了を表現する停止(stopped)完了関数である。完了関数の呼び出しは完了操作と呼ばれる。
停止完了関数には完了タグset_stopped_t
が関連付けられ、完了操作の停止完了シグネチャは戻り値型set_stopped_t
と0個の引数を持つ関数型として表現される。
効果
- 引数
rcvr
が左辺値またはconst右辺値の場合、式set_stopped(rcvr)
は不適格となる。 - そうでなければ、
rcvr.set_stopped()
と等価である。
例外
投げない
カスタマイゼーションポイント
Receiver型の非const右辺値rcvr
に対して式rcvr.set_stopped()
が呼び出される。
このとき、noexcept(rcvr.set_stopped()) == true
であること。
備考
完了関数set_stopped
はSender内部実装から呼び出される想定であり、実行制御ライブラリ利用者が直接利用する必要はない。
例
#include <execution>
namespace ex = std::execution;
struct StoppedReceiver {
using receiver_concept = ex::receiver_t;
// 停止完了シグネチャ set_stopped_t()
void set_stopped() && noexcept {}
};
int main()
{
StoppedReceiver rcvr;
ex::set_stopped(std::move(rcvr));
}
出力
バージョン
言語
- C++26
処理系
- Clang: ??
- GCC: ??
- ICC: ??
- Visual C++: ??