opAssign and const?

Era Scarecrow rtcvb32 at yahoo.com
Fri May 4 14:26:02 PDT 2012


On Friday, 4 May 2012 at 21:12:55 UTC, Steven Schveighoffer wrote:
> y[] = x2.y[];
> // as you did below

  That may deal with the language requirements, but the ideal was 
to take over the temporary; If not the ref would copy the 
contents. I wonder if I will need to have 2 copies of each 
opAssign to satisfy everything.

> btw, are you sure the lengths will always be identical?  
> Otherwise, you may want to do y.length = x2.y.length first.

  This example code doesn't cover that, but yes I have checks in 
place for such an occurrence. Likely 99% of the time copying will 
be between identical sizes.


More information about the Digitalmars-d-learn mailing list