Sean Kelly wrote:
== Quote from Andrei Alexandrescu ([email protected])'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

Reply via email to