-
Notifications
You must be signed in to change notification settings - Fork 2
comparatorsForType::GraterEqual(struct)
Igor Zarzycki edited this page Jan 24, 2022
·
4 revisions
Defined in "crap/functional.d/comparatorsfortype.h".
Defined in "crap/functional".
template <class Type>
struct comparatorsForType
{
/*...*/
template <Type Value1, Type Value2>
using GraterEqual = greaterEqualValue<Type, Value1, Value2>;
/*...*/
};
Creates greaterEqualValue
(see greaterEqualValue) acting on type Type
. Allows for greaterEqualValue
to act as binary value operator.
-
Value1
- value to be compared greater or equal againstValue2
. -
Value2
- value with whichValue1
is compared.
-
value
- true ifValue1
compares greater or equal toValue2
. False if not.
-
value_type
- type of fieldvalue
. May not bebool
but should be castable to this type.
-
constexpr operator value_type () const noexcept
- casts whole object to itsvalue_type
returningvalue
.
#include <crap/functional.d/comparatorsfortype.h>
int main()
{
using test1 = typename crap :: comparatorsForType <unsigned int> :: template GreaterEqual<42u, 101u>;
using test2 = typename crap :: comparatorsForType <unsigned int> :: template GreaterEqual<101u, 42u>;
using test3 = typename crap :: comparatorsForType <unsigned int> :: template GreaterEqual<42u, 42u>;
static_assert(!(test1 :: value), "test1: 42 should not be neither greater nor equal to 101.");
static_assert(test2 :: value, "test2: 101 should be greater or equal to 42.");
static_assert(test3 :: value, "test3: 42 should be greater or equal to 42.");
return 0;
}