Infinite loop using phobos sort

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Dec 15 17:46:41 PST 2010


On 12/15/10 7:15 PM, Nick Voronin wrote:
> On Thu, 16 Dec 2010 03:11:40 +0300, Craig Black <craigblack2 at cox.net>
> wrote:
>
>> When I try to use Phobos to sort my custom Array, it goes into an
>> infinite loop. I suspect I did something wrong with my Range struct.
>> Does anyone see an obvious flaw here?
>
> bordercase
>
>> this(ref Array!T array)
>> {
>> if(array.empty()) return;
>> start = &array.front();
>> end = &array.back();
>
> end points to last actual element

Perfect, I logged on to answer the same. Tip: always use begin = first 
element, end = past-last element.

Andrei



More information about the Digitalmars-d mailing list