arithmeticOperatorsForType::Negate(struct) - HaxyM/crap GitHub Wiki

crap :: arithmeticOperatorsForType :: Negate

Defined in "crap/functional.d/arithmeticoperatorsfortype.h".
Defined in "crap/functional".


template <class Type>
struct arithmeticOperatorsForType
{
 /*...*/
 template <Type Value>
 using Negate = negateValue<Type, Value>;
 /*...*/
};

Creates negateValue (see negateValue) acting on type Type. Allows for negateValue to act as unary value operator.

Template parameters

  • Value - value to be negated.

Layout

Member constants

  • value - holds result of negation of Value.

Member types

  • value_type - type of field value. May not be Type but should be castable to this type.

Member functions

  • constexpr operator value_type () const noexcept - casts whole object to its value_type returning value.

Usage example

#include <crap/functional.d/arithmeticoperatorsfortype.h>

int main()
{
 static_assert(crap :: arithmeticOperatorsForType <signed int> :: template Negate<-42>{} == 42, "Minus -42 should be 42");
 return 0;
}

See also

⚠️ **GitHub.com Fallback** ⚠️