move semantics are a mess

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Sun May 26 21:31:54 UTC 2019


On Sunday, 26 May 2019 at 19:19:12 UTC, Exil wrote:
> Think this has been brought up before, moving in D is 
> 'built-in' and is done as just a copy. Which is why there is 
> that opMove DIP. In C++ it is just a type essentially. If you 
> have a function that needs to forward it's parameters to 
> another function, in C++ where you are just passing a reference 
> in D that means making N copies, where N is the number of 
> function calls you have to go through. Price of performance for 
> "simplicity"?

Yes, but what I want to know is this: what happens if an 
exception is thrown right after the move? Does the ownership just 
disappear or is it moved back?

There is also this thread:

https://forum.dlang.org/thread/n8nm3u$1q1g$1@digitalmars.com?page=1




More information about the Digitalmars-d mailing list