[Issue 9071] sort function won't compile but Range fits describtion

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Nov 25 04:53:19 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=9071



--- Comment #2 from Robert Schadek <rburners at gmail.com> 2012-11-25 04:53:18 PST ---
where do you want the examples. it is pretty long 270 lines. The problem is a
combination of the way opSlice doesn't require a specific return type and. the
recursive nature of sortImpl and that sortImpl assigns slices. 


algorithm.d:7306
auto right = r[lessI + 1..r.length];        // here r is still of type Range
                                      // right is the return type of opSlice
auto left = r[0..min(lessI, greaterI + 1)]; // same goes for left
if (right.length > left.length)
{
    swap(left, right);
}
.sortImpl!(less, ss, Range)(right); // here sortImpl calls itself where right
is not of type Range
r = left; // this assignment will fail because the assign operator of Range is
not required to accept the return type of opSlice

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list