template <class Sch, class Allocator = allocator<void>>
requires(!same_as<task_scheduler, remove_cvref_t<Sch>>) && scheduler<Sch>
explicit task_scheduler(Sch&& sch, Allocator alloc = {}); // (1)
task_scheduler(const task_scheduler&) = default; // (2)
概要
- (1) : Scheduler
schとアロケータallocを保持するtask_schedulerオブジェクトを構築する。 - (2) : ムーブコンストラクタ
適格要件
Schはinfallible-scheduler<env<>>を満たす。
効果
(1) 説明専用のメンバ変数sch_をallocate_shared<backend-for<remove_cvref_t<Sch>>>(alloc, std::forward<Sch>(sch))で初期化する。
備考
処理系(標準ライブラリ実装)は、小さなSchedulerオブジェクトに対して動的メモリ確保を避けることが推奨される。
*this上の任意の呼び出しによるメモリ確保では、allocのコピーが用いられる。
バージョン
言語
- C++26
処理系
- Clang: ??
- GCC: ??
- ICC: ??
- Visual C++: ??