Ruling out arbitrary cost copy construction?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Oct 6 13:14:58 PDT 2010


On 10/6/10 13:59 CDT, Michel Fortin wrote:
> Could algorithms use "move" when possible (when "front" returns a ref)
> and do a copy when move isn't available? That'd be a good compromise I
> think.
>
> T tmp = moveOrCopy(r1.front);
> r1.front = moveOrCopy(r2.front);
> r2.front = moveOrCopy(tmp);

Then problem is, people sort ranges of their own objects and are amazed 
at the unbearable performance.

Andrei


More information about the Digitalmars-d mailing list