Skip to content

arithmeticOperatorsForType::plus2

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

crap :: arithmeticOperatorsForType :: plus2

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

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

Template parameters

  • Value1 - value to be summed with Value2.
  • Value2 - value to be summed with Value1.

Usage example

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

See also

Clone this wiki locally