Comment on Group Borrowing: Zero-cost memory safety with fewer restrictionsparentComments−littlestymaar1yIntriguing, what would be the purpose of such owning references compared to just passing ownership? Is that to have a way to reliably avoid memcopying large objects when passing them by value?−kibwen1y> Is that to have a way to reliably avoid memcopying large objects when passing them by value?I believe so, yes. Currently the only way to transfer ownership is by-value, and LLVM might optimize away the memcpy, but also it might not.−codedokode1yI wonder what is the case when you cannot optimize away memcpy, but can work around it with an "owning reference"?
Comments
Intriguing, what would be the purpose of such owning references compared to just passing ownership? Is that to have a way to reliably avoid memcopying large objects when passing them by value?
> Is that to have a way to reliably avoid memcopying large objects when passing them by value?
I believe so, yes. Currently the only way to transfer ownership is by-value, and LLVM might optimize away the memcpy, but also it might not.
I wonder what is the case when you cannot optimize away memcpy, but can work around it with an "owning reference"?