Skip to content

arithmeticOperatorsForType::divides2

Igor Zarzycki edited this page Feb 18, 2022 · 1 revision

crap :: arithmeticOperatorsForType :: divides2

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 divides2 = dividesValue <Type, Value1, Value2> :: value;
 /*...*/
};

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

Template parameters

  • Value1 - value to be divided by Value2.
  • Value2 - value divide Value1.

Usage example

#include <crap/functional.d/arithmeticoperatorsfortype.h>

int main()
{
 static_assert(crap :: arithmeticOperatorsForType <unsigned int> :: template divides2<42u, 42u> == 1u, "42 / 42 should be 1");
 static_assert(crap :: arithmeticOperatorsForType <unsigned int> :: template divides2<42u, 6u> == 7u, "42 / 6 should be 7");
 static_assert(crap :: arithmeticOperatorsForType <unsigned int> :: template divides2<42u, 101u> == (42u / 101u), "42 / 101 should be 0");
 return 0;
}

See also

Clone this wiki locally