-
Notifications
You must be signed in to change notification settings - Fork 2
arithmeticOperatorsForType::Negate(struct)
Igor Zarzycki edited this page Feb 15, 2022
·
1 revision
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.
-
Value
- value to be negated.
-
value
- holds result of negation ofValue
.
-
value_type
- type of fieldvalue
. May not beType
but should be castable to this type.
-
constexpr operator value_type () const noexcept
- casts whole object to itsvalue_type
returningvalue
.
#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;
}