arithmeticOperatorsForType::minus - HaxyM/crap GitHub Wiki

crap :: arithmeticOperatorsForType :: minus

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


template <class Type>
struct arithmeticOperatorsForType
{
 /*...*/
 template <Type ... Values>
 constexpr const static auto minus = minusValue <Type, Values...> :: value;
 /*...*/
};

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

Template parameters

  • Values... - values to operate on.

Usage example

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

int main()
{
 static_assert(crap :: arithmeticOperatorsForType <unsigned int> :: template minus<42u> == 42u, "42 should be 42");
 static_assert(crap :: arithmeticOperatorsForType <unsigned int> :: template minus<42u, 42u> == 0u, "42 - 42 should be 0");
 static_assert(crap :: arithmeticOperatorsForType <unsigned int> :: template minus<42u, 35u> == 7u, "42 - 35 should be 7");
 static_assert(crap :: arithmeticOperatorsForType <unsigned int> :: template minus<42u, 7u, 3u> == ((42u - 6u) - 3u),
 "42 - 7 - 3 should be 32");
 static_assert(crap :: arithmeticOperatorsForType <unsigned int> :: template minus<84u, 42u, 7u, 3u, 2u> == ((((84u - 42u) - 7u) - 3u) - 2u),
 " 84 - 42 - 7 - 3 - 2 should be 30");
 return 0;
}

See also

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