D's equivalent to C++'s std::move?
Minas Mina via Digitalmars-d
digitalmars-d at puremagic.com
Wed Feb 3 11:18:12 PST 2016
On Wednesday, 3 February 2016 at 18:04:38 UTC, Andrei
Alexandrescu wrote:
> On 02/03/2016 10:05 AM, Sönke Ludwig wrote:
>> For std.move, isn't the only place where an exception can be
>> thrown in
>> the destructor (which shouldn't throw)? It uses memcpy to move
>> the
>> memory around to circumvent any extended construction logic.
>
> Destructors in D are allowed to throw (thanks to exception
> chaining), but now I realize we need to amend that - the
> destructor of T.init should not be allowed to throw. -- Andrei
If this becomes the case, please make destructors nothrow so that
people won't screw up (like they can very easily do in C++).
More information about the Digitalmars-d
mailing list