xxxxxxxxxx
import std.stdio, std.traits;
bool isSorted(alias less = "a < b", Range)(Range r)
{
import std.algorithm : isSortedImpl = isSorted;
static if (isStaticArray!Range)
{
return isSortedImpl!less(r[]);
}
else
{
return isSortedImpl!less(r[]);
}
}
void main()
{
[0, 1, 2, 3, 4].isSorted.writeln;
static immutable arr = [0, 1, 2, 3, 4];
arr.isSorted;
}