命名空间
变体
操作

std::experimental::negation

来自 cppreference.cn
< cpp‎ | 实验性
定义于头文件 <experimental/type_traits>
template< class B >
struct negation;
(1) (库基础 TS v2)

构成类型特性 B 的逻辑非。

类型 negation<B> 是一个 一元类型特性 (UnaryTypeTrait),其基本特性是 std::integral_constant<bool, !bool(B::value)>

目录

[编辑] 模板参数

B - 任何类型,只要表达式 bool(B::value) 是一个有效的常量表达式

[编辑] 辅助变量模板

template< class B >
constexpr bool negation_v = negation<B>::value;
(库基础 TS v2)

继承自 std::integral_constant

成员常量

value
[静态]
true 如果 B 拥有成员 ::value 使得 !bool(B::value)true,否则为 false
(public static 成员常量)

成员函数

operator bool
将对象转换为 bool,返回 value
(公开成员函数)
operator()
(C++14)
返回 value
(公开成员函数)

成员类型

类型 定义
value_type bool
类型 std::integral_constant<bool, value>

[编辑] 可能实现

template<class B>
struct negation : std::integral_constant<bool, !bool(B::value)> {};

[编辑] 示例

[编辑] 参见

(C++17)
逻辑 NOT 元函数
(类模板) [编辑]