Standard library header <execution> (C++17)
From cppreference.net
此头文件属于 execution 和 algorithm 库的组成部分。
类 |
||
|
(C++17)
|
测试一个类是否表示执行策略
(类模板) |
|
|
定义于命名空间
std::execution
|
||
|
(C++17)
(C++17)
(C++17)
(C++20)
|
执行策略类型
(类) |
|
常量 |
||
|
定义于命名空间
std::execution
|
||
|
(C++17)
(C++17)
(C++17)
(C++20)
|
全局执行策略对象
(常量) |
|
|
本节内容不完整
原因:缺少执行库子页面的链接 |
概要
namespace std { // 执行策略类型特征 template<class T> struct is_execution_policy; // 独立实现 template<class T> constexpr bool is_execution_policy_v = is_execution_policy<T>::value; // 独立实现 } namespace std::execution { // 顺序执行策略 class sequenced_policy; // 并行执行策略 class parallel_policy; // 并行且无序执行策略 class parallel_unsequenced_policy; // 无序执行策略 class unsequenced_policy; // 执行策略对象 inline constexpr sequenced_policy seq{ /* 未指定 */ }; inline constexpr parallel_policy par{ /* 未指定 */ }; inline constexpr parallel_unsequenced_policy par_unseq{ /* 未指定 */ }; inline constexpr unsequenced_policy unseq{ /* 未指定 */ }; } namespace std { // 辅助概念 template<class T> concept /*movable-value*/ = /* 见描述 */; // 仅用于说明 template<class From, class To> concept /*decays-to*/ = same_as<decay_t<From>, To>; // 仅用于说明 template<class T> concept /*class-type*/ = /*decays-to*/<T, T> && is_class_v<T>; // 仅用于说明 // 可查询对象 template<class T> concept /*queryable*/ = /* 见描述 */; // 仅用于说明 // 查询 struct forwarding_query_t { /* 未指定 */ }; struct get_allocator_t { /* 未指定 */ }; struct get_stop_token_t { /* 未指定 */ }; inline constexpr forwarding_query_t forwarding_query{}; inline constexpr get_allocator_t get_allocator{}; inline constexpr get_stop_token_t get_stop_token{}; template<class T> using stop_token_of_t = remove_cvref_t<decltype(get_stop_token(declval<T>()))>; template<class T> concept /*forwarding-query*/ = forwarding_query(T{}); // 仅用于说明 } namespace std::execution { // 查询 struct get_domain_t { /* 未指定 */ }; struct get_scheduler_t { /* 未指定 */ }; struct get_delegation_scheduler_t { /* 未指定 */ }; struct get_forward_progress_guarantee_t { /* 未指定 */ }; template<class CPO> struct get_completion_scheduler_t { /* 未指定 */ }; inline constexpr get_domain_t get_domain{}; inline constexpr get_scheduler_t get_scheduler{}; inline constexpr get_delegation_scheduler_t get_delegation_scheduler{}; enum class forward_progress_guarantee; inline constexpr get_forward_progress_guarantee_t get_forward_progress_guarantee{}; template<class CPO> constexpr get_completion_scheduler_t<CPO> get_completion_scheduler{}; struct get_env_t { /* 未指定 */ }; inline constexpr get_env_t get_env{}; template<class T> using env_of_t = decltype(get_env(declval<T>())); template<class QueryTag, class ValueType> struct prop; template</*queryable*/... Envs> struct env; // 执行域 struct default_domain; // 调度器 struct scheduler_t {}; template<class Sch> concept scheduler = /* 见描述 */; // 接收器 struct receiver_t {}; template<class Rcvr> concept receiver = /* 见描述 */; template<class Rcvr, class Completions> concept receiver_of = /* 见描述 */; struct set_value_t { /* 未指定 */ }; struct set_error_t { /* 未指定 */ }; struct set_stopped_t { /* 未指定 */ <span class="br
辅助概念
namespace std { template<class T> concept /*可移动值*/ = // 仅用于说明 move_constructible<decay_t<T>> && constructible_from<decay_t<T>, T> && (!is_array_v<remove_reference_t<T>>); } namespace std { template<class T> concept /*可查询类型*/ = destructible<T>; // 仅用于说明 } namespace std::execution { template<class Sndr, class Env> concept /*单发送器*/ = sender_in<Sndr, Env> && requires { typename /*单发送器值类型*/<Sndr, Env>; }; }
辅助类
namespace std::execution { struct /*empty-variant*/ { // 仅用于说明 /*empty-variant*/() = delete; }; }
enum
std::forward_progress_guarantee
namespace std::execution { enum class forward_progress_guarantee { concurrent, parallel, weakly_parallel }; }
概念
scheduler
namespace std::execution { template<class Sch> concept scheduler = derived_from<typename remove_cvref_t<Sch>::scheduler_concept, scheduler_t> && /*可查询*/<Sch> && requires(Sch&& sch) { { schedule(std::forward<Sch>(sch)) } -> sender; { auto(get_completion_scheduler<set_value_t>( get_env(schedule(std::forward<Sch>(sch)))) } -> same_as<remove_cvref_t<Sch>>; } && equality_comparable<remove_cvref_t<Sch>> && copy_constructible<remove_cvref_t<Sch>>; }
概念
receiver
namespace std::execution { template<class Rcvr> concept receiver = derived_from<typename remove_cvref_t<Rcvr>::receiver_concept, receiver_t> && requires(const remove_cvref_t<Rcvr>& rcvr) { { get_env(rcvr) } -> /*queryable*/; } && move_constructible<remove_cvref_t<Rcvr>> && // 右值可移动,且 constructible_from<remove_cvref_t<Rcvr>, Rcvr>; // 左值可复制 template<class Signature, class Rcvr> concept /*valid-completion-for*/ = requires(Signature* sig) { []<class Tag, class... Args>(Tag(*)(Args...)) requires /*callable*/<Tag, remove_cvref_t<Rcvr>, Args...> { } (sig); }; template<class Rcvr, class Completions> concept /*has-completions*/ = requires(Completions* completions) { []</*valid-completion-for*/<Rcvr>... Sigs>(completion_signatures<Sigs...>*) { }(completions); }; template<class Rcvr, class Completions> concept receiver_of = receiver<Rcvr> && /*has-completions*/<Rcvr, Completions>; }
概念
operation_state
namespace std::execution { template<class O> concept operation_state = derived_from<typename O::operation_state_concept, operation_state_t> && is_object_v<O> && requires(O& o) { { start(o) } noexcept; }; }