| |
|
Seb
| https://issues.dlang.org/show_bug.cgi?id=12216
Seb <greensunny12@gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |greensunny12@gmail.com
--- Comment #1 from Seb <greensunny12@gmail.com> ---
This is going to be tough because some templates are written like this:
foo()
if (a)
foo()
if (!a)
There overloading is rather hard.
However, the following trick should always work:
---
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[]);
}
}
---
https://run.dlang.io/is/EL3VEj
Though nowadays this isn't even necessary for isSorted.
--
|