20 General utilities library [utilities]

20.15 Metaprogramming and type traits [meta]

20.15.8 Logical operator traits [meta.logical]

This subclause describes type traits for applying logical operators to other type traits.
template<class... B> struct conjunction : see below { };
The class template conjunction forms the logical conjunction of its template type arguments.
For a specialization conjunction<, , >, if there is a template type argument for which bool(​::​value) is false, then instantiating conjunction<, , >​::​value does not require the instantiation of ​::​value for .
[Note
:
This is analogous to the short-circuiting behavior of the built-in operator &&.
— end note
]
Every template type argument for which ​::​value is instantiated shall be usable as a base class and shall have a member value which is convertible to bool, is not hidden, and is unambiguously available in the type.
The specialization conjunction<, , > has a public and unambiguous base that is either
  • the first type in the list true_­type, , , for which bool(​::​value) is false, or
  • if there is no such , the last type in the list.
[Note
:
This means a specialization of conjunction does not necessarily inherit from either true_­type or false_­type.
— end note
]
The member names of the base class, other than conjunction and operator=, shall not be hidden and shall be unambiguously available in conjunction.
template<class... B> struct disjunction : see below { };
The class template disjunction forms the logical disjunction of its template type arguments.
For a specialization disjunction<, , >, if there is a template type argument for which bool(​::​value) is true, then instantiating disjunction<, , >​::​value does not require the instantiation of ​::​value for .
[Note
:
This is analogous to the short-circuiting behavior of the built-in operator ||.
— end note
]
Every template type argument for which ​::​value is instantiated shall be usable as a base class and shall have a member value which is convertible to bool, is not hidden, and is unambiguously available in the type.
The specialization disjunction<, , > has a public and unambiguous base that is either
  • the first type in the list false_­type, , , for which bool(​::​value) is true, or
  • if there is no such , the last type in the list.
[Note
:
This means a specialization of disjunction does not necessarily inherit from either true_­type or false_­type.
— end note
]
The member names of the base class, other than disjunction and operator=, shall not be hidden and shall be unambiguously available in disjunction.
template<class B> struct negation : see below { };
The class template negation forms the logical negation of its template type argument.
The type negation<B> is a Cpp17UnaryTypeTrait with a base characteristic of bool_­constant<!bool(B​::​​value)>.