isLessEqual

Tests whether Args[0] is less than or equal to 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 isLessEqual (
alias cmp
Args...
) if (
Args.length == 2 &&
__traits(isTemplate, cmp)
) {}

Members

Variables

isLessEqual
enum bool isLessEqual;
Undocumented in source.
isLessEqual
enum bool isLessEqual;
Undocumented in source.

Parameters

Args

Two aliases to compare for equality.

Return Value

$(D_KEYWORD true) if Args[0] is less than or equal to Args[1], $(D_KEYWORD false) otherwise.

Examples

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

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

Meta