On 6/9/15 8:14 AM, Namespace wrote:
On Tuesday, 9 June 2015 at 11:04:43 UTC, Stewart Gordon wrote:
Apologies if I've missed something - I haven't had much time to keep
up with the discussions lately.
What is the use case for rvalue references in a garbage-collected
language?
To me, it sounds like people want this feature for D purely because
C++ has it.
Stewart.
What does this have to do with "garbage-collected language"?
If I have a big struct, e.g.
----
struct Matrix {
float[16] values = [...];
}
----
I always want to pass it by ref because a move or a copy would be too slow.
It's actually faster to pass an rvalue by value, because it's
constructed on the stack anyway.
The real reason for this I think is to avoid building multiple functions
that have identical implementation.
-Steve