Boost logo

Boost :

Subject: Re: [boost] Proposed new RAII Library
From: Sergey Cheban (s.cheban_at_[hidden])
Date: 2012-09-15 11:25:29


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

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk