arithmeticOperatorsForType::modulus2 - HaxyM/crap GitHub Wiki

crap :: arithmeticOperatorsForType :: modulus2

Defined in "crap/functional.d/arithmeticoperatorsfortype.h".
Defined in "crap/functional".


template <class Type>
struct arithmeticOperatorsForType
{
 /*...*/
 template <Type Value1, Type Value2>
 constexpr const static auto modulus2 = modulusValue <Type, Value1, Value2> :: value;
 /*...*/
};

Member constant of arithmeticOperatorsForType. Stores value of modulusValue (see modulusValue) acting on type Type. Requires C++14 or higher language version.

Template parameters

  • Value1 - value to be modulo divided by Value2.
  • Value2 - value modulo divisor for Value1.

Usage example

#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;
}

See also

⚠️ **GitHub.com Fallback** ⚠️