std::negation_C++中文网

template<class B>
struct negation;

(C++17 起)

构建类型特性 B 的逻辑否定。

类型 std::negation<B> 是基特征 (BaseCharacteristic) 为 std::bool_constant<!bool(B::value)>一元类型特征 (UnaryTypeTrait)

添加 negationnegation_v 的特化的程序行为未定义。

模板形参

B - 使得表达式 bool(B::value) 为合法常量表达式的任何类型

辅助变量模板

template<class B>
inline constexpr bool negation_v = negation<B>::value;

(C++17 起)

继承自 std::integral_constant

成员常量

B 拥有在隐式转换为 bool 时等于 false::value 则为 true ,否则为 false
(公开静态成员常量)

成员函数

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

成员类型

可能的实现

示例

参阅