Hacker News new | ask | show | jobs
by plorkyeran 4665 days ago
s isn't an rvalue. It has a name, and you can refer to it within the body of the constructor.
1 comments

I understand that, but it's clearly not used in the body. I was hoping it would be a legal and implemented optimization.

move calls strike me as ugly and kinda dangerous. What if you do wind up wanting to refer to s in the body later on? It'd be nice if the compiler just handled it.

> What if you do wind up wanting to refer to s in the body later on?

Then copy s, don't move it.

The point is move makes things that look like values as annoying as pointers. You have to keep track.
I'll buy that.