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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Nov 25 05:12:33 PST 2012


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


monarchdodra at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|nobody at puremagic.com        |monarchdodra at gmail.com
           Severity|enhancement                 |normal


--- Comment #3 from monarchdodra at gmail.com 2012-11-25 05:12:32 PST ---
(In reply to comment #2)
> where do you want the examples. it is pretty long 270 lines.

You can post it in dpaste:
http://dpaste.dzfl.pl/new

An added bonus is that it should show us the exact same compile error you are
getting.

> 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

I see. In that case, there is a bit of both issues. Please post your code, I'll
take care of this issue.

-- 
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