On 6/9/15 10:53 AM, kink wrote:
On Tuesday, 9 June 2015 at 13:13:53 UTC, Steven Schveighoffer wrote:
It's actually faster to pass an rvalue by value, because it's
constructed on the stack anyway.
I seriously doubt that's true for a large struct, e.g., something
containing a large static array. Why move/copy the damn thing if I'm
only going to read a tiny portion of it?
Because it's not moved. It's written in the stack where it will be
passed to the next function.
Then access to the data is done via stack pointer offsets instead of an
extra indirection.
-Steve