-
Notifications
You must be signed in to change notification settings - Fork 2
comparatorsForType
Igor Zarzycki edited this page Jan 22, 2022
·
8 revisions
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.
-
Type
- type of values to operate on.
-
EqualTo
- equalToValue accepting two values of typeType
. CreatesequalToValue
comparing passed values (for details see comparatorsForType :: EqualTo). -
Grater
- greaterValue accepting two values of typeType
. CreatesgreaterValue
comparing passed values (for details see comparatorsForType :: Greater). -
GraterEqual
- greaterEqualValue accepting two values of typeType
. CreatesgreaterEqualValue
comparing passed values (for details see comparatorsForType :: GreaterEqual). -
Less
- lessValue accepting two values of typeType
. CreateslessValue
comparing passed values (for details see comparatorsForType :: Less). -
LessEqual
- lessEqualValue accepting two values of typeType
. CreateslessEqualValue
comparing passed values (for details see comparatorsForType :: LessEqual). -
NotEqualTo
- notEqualToValue accepting two values of typeType
. CreatesnotEqualToValue
comparing passed values (for details see comparatorsForType :: NotEqualTo).
#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;
}
- comparatorsForType :: EqualTo
- comparatorsForType :: Grater
- comparatorsForType :: GraterEqual
- comparatorsForType :: Less
- comparatorsForType :: LessEqual
- comparatorsForType :: NotEqualTo
- comparatorsForType :: equalTo
- comparatorsForType :: grater
- comparatorsForType :: graterEqual
- comparatorsForType :: less
- comparatorsForType :: lessEqual
- comparatorsForType :: notEqualTo
- equalToValue
- greaterValue
- greaterEqualValue
- lessValue
- lessEqualValue
- notEqualToValue