The following example worked with DMD 2.081.0 but fails to compile with 2.082.0 and later:
import std.algorithm;
void main()
{
[1, 2,].sort.sort;
}
The error message is:
phobos/std/algorithm/sorting.d(1877): Error: cannot implicitly convert expression assumeSorted(r) of type SortedRange!(int[], "a < b") to SortedRange!(SortedRange!(int[], "a < b"), "a < b")
main.d(5): Error: template instance `std.algorithm.sorting.sort!("a < b", cast(SwapStrategy)0, SortedRange!(int[], "a < b"))` error instantiating
Comment #1 by greeenify — 2018-10-27T15:06:45Z
A temporary workaround is to do:
arr.sort.release.sort
Comment #2 by iamthewilsonator — 2018-10-27T23:01:28Z
Looks like something like https://github.com/dlang/phobos/blob/master/std/complex.d#L656 would help here.
/* Makes Complex!(Complex!T) fold to Complex!T.
The rationale for this is that just like the real line is a
subspace of the complex plane, the complex plane is a subspace
of itself. Example of usage:
---
Complex!T addI(T)(T x)
{
return x + Complex!T(0.0, 1.0);
}
---
The above will work if T is both real and complex.
*/
template Complex(T)
if (is(T R == Complex!R))
{
alias Complex = T;
}