On Wednesday, 3 February 2016 at 15:05:39 UTC, 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.

Not sure if you are talking about something else, but in C++ if you do

"somefunction(std::move(resource))"

then somefunction can throw and the resource remains untouched (if implemented in a reasonable fashion).


In D, std.move(...) has this implementation:

private T moveImpl(T)(ref T source)
{
    T result = void;
    moveEmplace(source, result);
    return result;
}

So clearly by the time somefunction is called, the resource is already moved and an exception will cause permanent damage?



Reply via email to