comparatorsForType - HaxyM/crap GitHub Wiki

crap :: comparatorsForType

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


template <class Type>
struct comparatorsForType;

Creates equalToValue (see equalToValue), greaterEqualValue (see greaterEqualValue), greaterValue (see greaterValue), lessEqualValue (see lessEqualValue) and lessValue (see lessValue) and notEqualToValue (see notEqualToValue) acting on type Type. Allows for equalToValue, greaterEqualValue, greaterValue, lessEqualValue, lessValue and notEqualToValue to act as binary value operator.

Template parameters

  • Type - type of values to operate on.

Layout

Member types

Usage example

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

int main()
{
 using test1 = typename crap :: comparatorsForType <unsigned int> :: template EqualTo<42u, 42u>;
 using test2 = typename crap :: comparatorsForType <unsigned int> :: template Greater<101u, 42u>;
 using test3 = typename crap :: comparatorsForType <unsigned int> :: template GreaterEqual<42u, 42u>;
 using test4 = typename crap :: comparatorsForType <unsigned int> :: template Less<42u, 101u>;
 using test5 = typename crap :: comparatorsForType <unsigned int> :: template LessEqual<42u, 42u>;
 using test6 = typename crap :: comparatorsForType <unsigned int> :: template NotEqualTo<101u, 42u>;

 static_assert(test1 :: value, "test1: 42 should be equal to 42.");
 static_assert(test2 :: value, "test2: 101 sould be greater than 42.");
 static_assert(test3 :: value, "test3: 42 sould be greater than or equal to 42.");
 static_assert(test4 :: value, "test4: 42 should be less than 101.");
 static_assert(test5 :: value, "test5: 42 should be less than or equal to 42.");
 static_assert(test6 :: value, "test6: 101 should not be equal to 42.");
 return 0;
}

See also

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