Move Constructors - Converting Lvalues to Rvalues
Walter Bright
newshound2 at digitalmars.com
Tue Oct 1 06:36:42 UTC 2024
On 9/30/2024 8:29 PM, Richard (Rikki) Andrew Cattermole wrote:
> Perhaps an attribute, like ``@move`` in core.attributes would be sufficient for
> this task ;)
It's an interesting idea, but a lot of details would need to be worked out. For
instance, the core.attributes.move is a version of the move assignment operator,
not move construction. Then there is the problem of distinguishing between a
move constructor and a copy constructor - how do they overload against each
other? There's what a default move constructor should be. There's what happens
when a field of a struct has a move constructor.
And so on.
BTW, I took a look at core.lifetime.move. It's hard to figure out just what it
does, as there are vacuous forwardings to other templates.
For example:
```
void move(T)(ref T source, ref T target)
{
moveImpl(target, source);
}
```
Why?
More information about the Digitalmars-d
mailing list