max

Iterates the passed arguments and returns the minimum value.

max
(
T...
)
()
if (
T.length >= 2
)

Return Value

Type: auto

The minimum of the passed-in values.

Examples

int a = 5;
short b = 6;
double c = 2;
auto d = max(a, b);
static assert(is(typeof(d) == int));
assert(d == 6);
auto e = min(a, b, c);
static assert(is(typeof(e) == double));
assert(e == 2);

max is not defined for arguments of mixed signedness because of security reasons. Please unify type or use a Phobos analog.

int a = -10;
uint b = 10;
static assert(!is(typeof(max(a, b))));

Meta