Max

Finds the maximum value in Args according to pred.

Args should contain at least one element.

pred 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.

Members

Aliases

Max
alias Max = Alias!(Args[0])
Undocumented in source.
Max
alias Max = Max!(pred, Args[1], Args[2..$])
Undocumented in source.
Max
alias Max = Max!(pred, Args[0], Args[2..$])
Undocumented in source.

Parameters

pred

Template predicate.

Args

Elements for which you want to find the maximum value.

Return Value

The maximum.

Examples

enum bool cmp(alias T, alias U) = T < U;
static assert(Max!(cmp, 8, 4, 5, 3, 13) == 13);
static assert(Max!(cmp, 8) == 8);

See Also

$(D_PSYMBOL isLess).

Meta