std:: negation
| Type traits | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Compile-time rational arithmetic | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Compile-time integer sequences | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
(C++14)
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
定義先ヘッダ
<type_traits>
|
||
|
template
<
class
B
>
struct negation ; |
(C++17以降) | |
論理的否定 を型特性 B に対して形成します。
型 std :: negation < B > は、 UnaryTypeTrait であり、基本特性は std:: bool_constant < ! bool ( B :: value ) > です。
プログラムが
std::negation
または
std::negation_v
に対する特殊化を追加する場合、動作は未定義です。
目次 |
テンプレートパラメータ
| B | - | 式 bool ( B :: value ) が有効な定数式となる任意の型 |
ヘルパー変数テンプレート
|
template
<
class
B
>
constexpr bool negation_v = negation < B > :: value ; |
(C++17以降) | |
std:: integral_constant から継承
メンバ定数
|
value
[static]
|
true
B
が
::
value
メンバを持ち、かつ明示的に
bool
に変換した際に
false
となる場合は
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::bool_constant<!bool(B::value)> { }; |
注記
| 機能テスト マクロ | 値 | 標準 | 機能 |
|---|---|---|---|
__cpp_lib_logical_traits
|
201510L
|
(C++17) | 論理演算子型特性 |
例
#include <type_traits> static_assert( std::is_same< std::bool_constant<false>, typename std::negation<std::bool_constant<true>>::type>::value, ""); static_assert( std::is_same< std::bool_constant<true>, typename std::negation<std::bool_constant<false>>::type>::value, ""); static_assert(std::negation_v<std::bool_constant<true>> == false); static_assert(std::negation_v<std::bool_constant<false>> == true); int main() {}
関連項目
|
(C++17)
|
可変長論理積メタ関数
(クラステンプレート) |
|
(C++17)
|
可変長論理和メタ関数
(クラステンプレート) |
|
(C++11)
(C++17)
|
指定された型と値を持つコンパイル時定数
(クラステンプレート) |