Skip to content

arithmeticOperatorsForType::Negate(struct)

Igor Zarzycki edited this page Feb 15, 2022 · 1 revision

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

Clone this wiki locally