◐ Shell
clean mode source ↗

std::is_execution_policy - cppreference.com

来自cppreference.com

template< class T >
struct is_execution_policy;
(C++17 起)

检查 T 是否为标准或实现定义的执行策略类型。

T标准执行策略类型或实现定义的执行策略类型,则提供等于 true 的成员常量 value。否则,value 等于 false

如果程序添加了 std::is_execution_policystd::is_execution_policy_v 的特化,那么行为未定义。

模板形参

辅助模板

template< class T >
constexpr bool is_execution_policy_v = std::is_execution_policy<T>::value;
(C++17 起)

继承自 std::integral_constant

成员常量

如果 T 是标准或实现定义的执行策略类型那么是 true,否则是 false
(公开静态成员常量)

成员函数

将对象转换到 bool,返回 value
(公开成员函数)
返回 value
(公开成员函数)

成员类型

类型 定义
value_type bool
type std::integral_constant<bool, value>
#include <execution>

static_assert(std::is_execution_policy_v<std::execution::unsequenced_policy>);
static_assert(!std::is_execution_policy_v<int>);

int main() {}

参阅