-
Notifications
You must be signed in to change notification settings - Fork 2
arithmeticOperatorsForType::multiplies2
Igor Zarzycki edited this page Feb 18, 2022
·
1 revision
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 multiplies2 = multipliesValue <Type, Value1, Value2> :: value;
/*...*/
};
Member constant of arithmeticOperatorsForType
. Stores value of multipliesValue
(see multipliesValue) acting on type Type
. Requires C++14 or higher language version.
-
Value1
- value to be muliplied byValue2
. -
Value2
- value to multiply withValue1
.
#include <crap/functional.d/arithmeticoperatorsfortype.h>
int main()
{
static_assert(crap :: arithmeticOperatorsForType <unsigned int> :: template multiplies2<42u, 0u> == 0u, "42 * 0 should be 0");
static_assert(crap :: arithmeticOperatorsForType <unsigned int> :: template multiplies2<42u, 1u> == 42u, "42 * 1 should be 42");
static_assert(crap :: arithmeticOperatorsForType <unsigned int> :: template multiplies2<6u, 7u> == 42u, "6 * 7 should be 42");
return 0;
}