
15 Sep
2012
15 Sep
'12
3:25 p.m.
15.09.2012 13:36, Matus Chochlik пишет:
Whats wrong is (if I'm not teribly mistaken) is best illustrated by the "transaction" example in the GOTW:
Transaction::~Transaction() { if( uncaught_exception() ) { RollBack(); } }
If the transaction is used in a destructor:
U::~U() { try { Transaction t( /*...*/ ); // do work } catch( ... ) { // clean up } } Got it.
Things probably would be better with if( uncaught_exception_level() > m_UncaughtLevel ) { RollBack(); } but there is no such function in C++. :-( -- Best regards, Sergey Cheban