|
|
|
|
|
by eco
896 days ago
|
|
This is done so you can use std::move to take ownership of the allocated memory in these objects rather than do a new allocation. Passing by value rather than rvalue reference let's your function be more flexible at the call site. You can pass an rvalue/move or just make a copy at the call site which means the caller (who actually knows if a copy or a move is more appropriate) gets to control how the memory gets allocated. An unnecessary memory allocation is much more of a performance hit than suboptimal calling convention. |
|