Boost logo

Boost Users :

From: Denis G. Priyomov (DenisPriyomov_at_[hidden])
Date: 2006-03-24 09:46:08


Wouldn't it be nice to extend shared_ptr to support transaction-like
semantics? Or is it possible already?
Sometimes it's needed to execute code on exit only until we haven't reached
some point (of "no return"):

{

    shared_ptr<void> cr_guard(static_cast<void*>(0), bind(rollback_fun, x,
y));

    [...some critical part which should call rollback_fun on failure
only...]

    //don't call rollback_fun if we get here
    cr_guard.commit();

    [...any code that follows...]

}

Thanks!

Wish you well!
-=-=-=-=-=-=-=-=-=-
Denis G. Priyomov


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net