Move Constructors - Converting Lvalues to Rvalues

Dukc ajieskola at gmail.com
Tue Oct 1 07:25:08 UTC 2024


On Tuesday, 1 October 2024 at 03:22:33 UTC, Walter Bright wrote:
> On 9/30/2024 10:49 AM, Dukc wrote:
>> Doesn't `core.lifetime.move` already do this?
>
> Since the compiler doesn't know about it, the potential for 
> optimizations, lifetime analysis, etc., is lost.

You can make it to work with a compiler instrinsic. The intrinsic 
would either be an UDA applied to `move` that allows the compiler 
to make those assumptions, or an intrinsic function that works 
along the lines of `nove` and `moveEmplace`. The public DRuntime 
functions would forward or alias to the instrinsic function.


More information about the Digitalmars-d mailing list