DIP44: scope(class) and scope(struct)

Dmitry Olshansky dmitry.olsh at gmail.com
Tue Aug 27 13:24:43 PDT 2013


27-Aug-2013 18:25, H. S. Teoh пишет:
> On Tue, Aug 27, 2013 at 04:01:57PM +0400, Dmitry Olshansky wrote:

>
> What if move(r2) throws? Then res1 won't get cleaned up, because r1 has
> already been nulled by the move.
>

Then something is terribly wrong :)

Rule #1 of move should be is that it doesn't throw.

It just blits the damn data. Even if this is currently broken..
At the very least 2-arg version certainly can avoid throw even if T has 
a bogus destructor that goes bottom up on T.init.

BTW same with swap and at least in C++ that's the only way to avoid 
exceptions creeping up from nowhere.


-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list