~= call copy ctor?

Jonathan M Davis jmdavisProg at gmx.com
Fri Jul 20 08:29:30 PDT 2012


On Friday, July 20, 2012 08:08:47 Jonathan M Davis wrote:
> On Friday, July 20, 2012 15:50:19 Namespace wrote:
> > Why on earth....?
> 
> http://stackoverflow.com/questions/6884996/questions-about-postblit-and-move
> - semantics
> 
> If you want to guarantee that you don't get any copies while moving an
> object around, it needs to be a reference type (which would include a
> pointer to a value type).

Alternatively, you can @disable this(this), which would make copies illegal, 
but then I'd be worried about code breaking when the compiler adjusted some of 
its optimizations (though it would generally be unlikely for a move to become 
a copy - the opposite would be far more likely, which wouldn't break 
anything).

- Jonathan M Davs


More information about the Digitalmars-d-learn mailing list