命名空间
变体
操作

std::experimental::negation

来自 cppreference.cn
定义于头文件 <experimental/type_traits>
template< class B >
struct negation;
(1) (library fundamentals 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;
(library fundamentals TS v2)

继承自 std::integral_constant

成员常量

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

成员函数

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

成员类型

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

[编辑] 可能的实现

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

[编辑] 示例

[编辑] 参见

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