Add `__rvalue` as a new parameter storage class
Walter Bright
newshound2 at digitalmars.com
Sun Feb 2 03:37:32 UTC 2025
C++ identifies move constructors with a special syntax on the constructor. D
does move construction by specifying that the argument is an rvalue.
The only purpose I can see for specifying a move constructor in D is to call a
C++ move constructor. But do we really need to do that? A constructor that takes
an rvalue parameter is already a move constructor, even in C++, it's just that
C++ didn't notice that (I presume, as I wasn't privy to those discussions).
Adding a 3rd parameter form adds a terrifying new layer of overload resolution.
I already had a terrible time folding in __rvalue arguments to the overloading
without breaking existing code.
This proposal would need a really strong motivation for it, as I'm pretty sure
we're good to go with our existing move constructors.
More information about the dip.ideas
mailing list