isSorted

Tests whether L is sorted in ascending order according to cmp.

cmp can evaluate to:

  • $(D_KEYWORD bool): $(D_KEYWORD true) means ai < a[i + 1].
  • $(D_KEYWORD int): a negative number means that ai < a[i + 1], a positive number that ai > a[i + 1], 0 if they equal.

Members

Variables

isSorted
enum bool isSorted;
Undocumented in source.
isSorted
enum bool isSorted;
Undocumented in source.

Parameters

cmp

Sorting template predicate.

L

Elements to be tested.

Return Value

$(D_KEYWORD true) if L is sorted, $(D_KEYWORD false) if not.

Examples

enum cmp(T, U) = T.sizeof < U.sizeof;
static assert(isSorted!(cmp));
static assert(isSorted!(cmp, byte));
static assert(isSorted!(cmp, byte, ubyte, short, uint));
static assert(!isSorted!(cmp, long, byte, ubyte, short, uint));

Meta