Blocker for the container work

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Fri Nov 13 09:43:51 PST 2015


On Friday, 13 November 2015 at 17:25:44 UTC, rsw0x wrote:
> afaik that's RVO, isn't it?
> D's RVO semantics are pretty much unspecified still(outside of 
> dmd,) I believe(don't quote me) that walter said it's supposed 
> to be part of the spec but I could never find anything.

Well, RVO is used when the value being returned is a local 
variable. The compiler knows that it can be moved rather than 
copied, so it's moved. However, the this pointer/reference isn't 
a local variable. It's a member variable. So, it can't be moved. 
So, RVO shouldn't kick in when returning this.

- Jonathan M Davis


More information about the Digitalmars-d mailing list