std.partition is fucked

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed May 13 10:44:22 PDT 2009


Sean Kelly wrote:
> Andrei Alexandrescu wrote:
>>
>> Note how the left edge of result follows the left edge of r, but the 
>> right edge stays put because partition() returns the right-hand-side 
>> range. r shrinks from both ends to exhaustion.
> 
> So all the elements that satisfy the predicate end up at the end of the 
> original range instead of the beginning?  Was that an arbitrary choice, 
> or is there a reason for it?

The elements satisfying the predicate are at the beginning, see e.g. the
unittests. The range returned is (as always) the right-hand side, i.e.
the range containing the elements that don't satisfy the predicate.

Andrei



More information about the Digitalmars-d mailing list