Discussion: Rvalue refs and a Move construtor for D
sahmi.soulaimane at gmail.com
Wed Sep 4 14:45:35 UTC 2019
On Wednesday, 4 September 2019 at 00:58:44 UTC, Manu wrote:
> Move semantics aren't a feature of the move constructor, they
> are USED
> BY the move constructor.
> You can move an argument to any function. Consider a
> unique_ptr, which
> can only move. It would be impossible to pass a unique_ptr to
> other function than the move constructor itself.
If you can get the move constructor and move assignment in
addition to an intrinsic function for moving lvalues to rvalues
then you can do move semantics without rvalue ref.
unique_ptr in C++ doesn't move itself magically. You have to
eplicitly move it by calling `move()`. Example:
You can do that with the machinery provided in the POC without
More information about the Digitalmars-d