isGreater

Tests whether Args[0] is greater than Args[1] according to cmp.

cmp can evaluate to:

  • $(D_KEYWORD bool): $(D_KEYWORD true) means Args[0] < Args[1].
  • $(D_KEYWORD int): a negative number means that Args[0] < Args[1], a positive number that Args[0] > Args[1], 0 if they equal.
template isGreater (
alias cmp
Args...
) if (
Args.length == 2 &&
__traits(isTemplate, cmp)
) {}

Members

Variables

isGreater
enum bool isGreater;
Undocumented in source.
isGreater
enum bool isGreater;
Undocumented in source.

Parameters

Args

Two aliases to compare for equality.

Return Value

$(D_KEYWORD true) if Args[0] is greater than Args[1], $(D_KEYWORD false) otherwise.

Examples

enum bool boolCmp(T, U) = T.sizeof < U.sizeof;
static assert(!isGreater!(boolCmp, byte, int));
static assert(!isGreater!(boolCmp, uint, int));
static assert(isGreater!(boolCmp, long, int));

enum ptrdiff_t intCmp(T, U) = T.sizeof - U.sizeof;
static assert(!isGreater!(intCmp, byte, int));
static assert(!isGreater!(intCmp, uint, int));
static assert(isGreater!(intCmp, long, int));

Meta