Move Constructors - Converting Lvalues to Rvalues
Walter Bright
newshound2 at digitalmars.com
Tue Oct 1 03:10:29 UTC 2024
On 9/30/2024 12:37 PM, Timon Gehr wrote:
> On 9/30/24 18:05, Walter Bright wrote:
>>
>> So, does anyone have any brilliant ideas for how to make the compiler treat an
>> lvalue as an rvalue?
>
> Well, with DIP1040 this is automatically the case for last uses.
The trouble with last uses is detecting them. It's a variation on live variable
DFA, which the optimizer does for variables. Indirections cannot be reliably
tracked, and variables which have their address taken similarly can't reliably
have DFA done on them.
In any case, I decided for at least the first implementation to require an
explicit "convert to rvalue" operation to get the benefits of a move
construction. I'm pretty sure it will deliver most of what we want.
More information about the Digitalmars-d
mailing list