std.partition is fucked

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed May 13 13:31:00 PDT 2009


Sean Kelly wrote:
> == Quote from Andrei Alexandrescu (SeeWebsiteForEmail at erdani.org)'s article
>> If swap is not inlined that would be serious. Sort does a lot of swapping.
> 
> It only works for arrays, but what I ended up doing to get swap inlined
> was to pass it two array indices instead of two references.  There must
> be some way to address this for ranges if ref parameters prevent inlining
> with DMD.

Well the least we can do is to say

static if (is(Range R == T[], T))
{
     ... use array-specific swap ...
}
else
{
     ... use regular swap ...
}


Andrei



More information about the Digitalmars-d mailing list