-
Notifications
You must be signed in to change notification settings - Fork 2
arithmeticOperatorsForType::Minus2(struct)
Igor Zarzycki edited this page Feb 1, 2022
·
1 revision
Defined in "crap/functional.d/arithmeticoperatorsfortype.h".
Defined in "crap/functional".
template <class Type>
struct arithmeticOperatorsForType
{
/*...*/
template <Type Value1, Type Value2>
using Minus2 = minusValue<Type, Value1, Value2>;
/*...*/
};
Creates minusValue
(see minusValue) acting on type Type
. Allows for minusValue
to act as binary value operator.
-
Value1
- value to be minuend. -
Value2
- value to be subtracted fromValue1
.
-
value
- holds result of subtraction ofValue1
withValue2
.
-
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 <unsigned int> :: template Minus2<42u, 42u>{} == 0u, "42 - 42 should be 0");
static_assert(crap :: arithmeticOperatorsForType <unsigned int> :: template Minus2<42u, 35u>{} == 7u, "42 - 35 should be 7");
return 0;
}