Move Constructors - Converting Lvalues to Rvalues
Timon Gehr
timon.gehr at gmx.ch
Thu Oct 3 20:52:52 UTC 2024
On 10/3/24 17:47, Walter Bright wrote:
>
> __rvalue() is not a move, it just guides the overload resolution to the
> move constructor/assignment. It's a hint.
It has to be a move though. An rvalue is owned, an lvalue is not.
Whenever an lvalue goes into an rvalue, it is either copy or move.
If `__rvalue` is just some sort of ad-hoc type-punning operation
exclusively for overload resolution, it will often copy the argument,
unless your intention is to force it to be consumed by a function that
is implicitly `@move` (such as a move constructor or a move assignment).
More information about the Digitalmars-d
mailing list