arithmeticOperatorsForType::Modulus2(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 Modulus2 = modulusValue<Type, Value1, Value2>;
/*...*/
};Creates modulusValue (see modulusValue) acting on type Type. Allows for modulusValue to act as binary value operator.
-
Value1- value to be dividend. -
Value2- value to be modulo divisor forValue1.
-
value- holds result of modulo 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 Modulus2<42u, 42u>{} == 0u, "42 % 42 should be 0");
static_assert(crap :: arithmeticOperatorsForType <unsigned int> :: template Modulus2<101, 42u>{} == 17u, "101 % 42 should be 17");
return 0;
}