negateValue - HaxyM/crap GitHub Wiki
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 beTypebut should be castable to this type.
-
constexpr operator value_type () const noexcept- casts whole object to itsvalue_typereturningvalue.
#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;
}