[challenge] Bounded types

Denis Koroskin 2korden at gmail.com
Sun Oct 10 15:16:09 PDT 2010


Your code is wrong in many places. In short, exceptional situation should  
leave your object in correct state. E.g. the following is invalid:

_payload += stuff;
mixin(runCheckCode());

while the following is correct:

T tmp = _payload + stuff;
mixin(runCheckCode());
_payload = tmp;

There is a great book about Exception Safety by Scott Meyers, I highly  
recommend reading it. At the very least read this:
http://en.wikipedia.org/wiki/Exception_handling#Exception_safety


More information about the Digitalmars-d mailing list