D's equivalent to C++'s std::move?

Ola Fosheim Grøstad via Digitalmars-d digitalmars-d at puremagic.com
Wed Feb 3 07:56:48 PST 2016


On Wednesday, 3 February 2016 at 15:44:25 UTC, Sönke Ludwig wrote:
> seems like pretty clear semantics. And in C++ you'd have the 
> same situation once somefunction decides to move/swap the value 
> somewhere else before throwing an exception.

Well, you can always move it back or wait with the move.

Also, std.move may end up being inefficient when you have a 
complicated resource holder. Since the work is done before 
calling the function the optimizer may struggle with getting rid 
of the work.



More information about the Digitalmars-d mailing list