-
Notifications
You must be signed in to change notification settings - Fork 2
negateValue
Igor Zarzycki edited this page Jan 28, 2022
·
1 revision
Defined in "crap/functional.d/negatevalue.h".
Defined in "crap/functional".
template <class Type, Type Value> struct negateValue;
Returns arithmetic negation of Value
.
-
Type
- type of values to operate on. -
Value
- value to negate.
-
value
- holds result of operation.
-
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/negatevalue.h>
int main()
{
static_assert(crap :: negateValue<int, -42>{} == 42, "minus -42 should be 42");
static_assert(crap :: negateValue<int, 42>{} == -42, "minus 42 should be -42");
static_assert(crap :: negateValue<int, 0>{} == 0, "minus 0 should be 0");
return 0;
}