Namespaces
Variants

std::experimental:: negation

From cppreference.net
定义于头文件 <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 ;
(库基础技术规范 v2)

继承自 std:: integral_constant

成员常量

value
[static]
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)
逻辑非元函数
(类模板)