arithmeticOperatorsForType::Plus2(struct) - HaxyM/crap GitHub Wiki
Defined in "crap/functional.d/arithmeticoperatorsfortype.h".
Defined in "crap/functional".
template <class Type>
struct arithmeticOperatorsForType
{
/*...*/
template <Type Value1, Type Value2>
using Plus2 = plusValue<Type, Value1, Value2>;
/*...*/
};Creates plusValue (see plusValue) acting on type Type. Allows for plusValue to act as binary value operator.
-
Value1- value to be summed withValue2. -
Value2- value to be summed withValue1.
-
value- holds result of addition ofValue1withValue2.
-
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/arithmeticoperatorsfortype.h>
int main()
{
static_assert(crap :: arithmeticOperatorsForType <unsigned int> :: template Plus2<42u, 0u>{} == 42u, "42 + 0 should be 42");
static_assert(crap :: arithmeticOperatorsForType <unsigned int> :: template Plus2<20u, 22u>{} == 42u, "20 + 22 should be 42");
return 0;
}