comparatorsForType::lessEqual - HaxyM/crap GitHub Wiki

crap :: comparatorsForType :: lessEqual

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


template <class Type>
struct comparatorsForType
{
 /*...*/
 template <Type Value1, Type Value2>
 constexpr const static auto lessEqual = lessEqualValue <Type, Value1, Value2> :: value;
 /*...*/
};

Member constant of comaratorsForType. Compares passed value Value1 if less than or equal to Value2. Requires C++14 or higher language version.

Template parameters

  • Value1 - value to be compared less or equal against Value2.
  • Value2 - value with which Value1 is compared.

Usage example

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

int main()
{
 constexpr const static auto test1 = crap :: comparatorsForType <unsigned int> :: template lessEqual<42u, 101u>;
 constexpr const static auto test2 = crap :: comparatorsForType <unsigned int> :: template lessEqual<101u, 42u>;
 constexpr const static auto test3 = crap :: comparatorsForType <unsigned int> :: template lessEqual<42u, 42u>;

 static_assert(test1, "test1: 42 should be less than or equal to 101.");
 static_assert(!test2, "test2: 101 should not be neither less than nor equal to 42.");
 static_assert(test3, "test3: 42 should be less than or equal to 42.");
 return 0;
}

See also

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