std::negation - cppreference.com (original) (raw)

| | | | | ------------------------------------- | | ------------- | | template< class B > struct negation; | | (since C++17) |

Forms the logical negation of the type trait B.

The type std::negation<B> is a UnaryTypeTrait with a base characteristic of std::bool_constant<!bool(B::value)>.

If the program adds specializations for std::negation or std::negation_v, the behavior is undefined.

Contents

[edit] Template parameters

B - any type such that the expression bool(B::value) is a valid constant expression

[edit] Helper variable template

| template< class B > constexpr bool negation_v = negation<B>::value; | | (since C++17) | | ----------------------------------------------------------------------- | | ------------- |

Inherited from std::integral_constant

Member constants

| | true if B has a member ::value that is false when explicitly converted to bool, false otherwise (public static member constant) | | ---------------------------------------------------------------------------------------------------------------------------------- |

Member functions

| | converts the object to bool, returns value (public member function) | | ---------------------------------------------------------------------- | | | returns value (public member function) |

Member types

[edit] Possible implementation

[edit] Notes

Feature-test macro Value Std Feature
__cpp_lib_logical_traits 201510L (C++17) Logical operator type traits

[edit] Example

[edit] See also