Move Constructors - Converting Lvalues to Rvalues

Collin Daugherty wilberthayes79 at gmail.com
Fri Nov 15 08:57:13 UTC 2024


On Monday, 30 September 2024 at 17:27:25 UTC, Bastiaan Veelo 
wrote:
> On Monday, 30 September 2024 at 16:05:16 UTC, Walter Bright 
> wrote:
> [...]
>> P.S. C++ uses the std::move function to do it:
>>
>> https://learn.microsoft.com/en-us/cpp/standard-library/utility-functions?view=msvc-170#move
>>
>> which relies on rvalue references:
>>
>> https://learn.microsoft.com/en-us/cpp/cpp/rvalue-reference-declarator-amp-amp?view=msvc-170 https://geometry-dashonline.com
>>
>> which is a major feature which I prefer to avoid.
>
> I suppose `-preview=rvaluerefparam` is not relevant here, right?
>
> -- Bastiaan.
The -preview=rvaluerefparam flag isn’t directly relevant to 
replicating std::move in D. It enables efficient parameter 
passing with rvalue references but isn’t required for typical 
move semantics in D. Instead, D provides simpler, explicit 
mechanisms for similar functionality without adding the 
complexity of C++'s rvalue reference features.


More information about the Digitalmars-d mailing list