
Hello Andrey. On 9-Apr-07, at 12:56 PM, Andrey Semashev wrote:
Hello Alexander,
Monday, April 9, 2007, 10:46:24 AM, you wrote:
Andrey Semashev wrote:
Another good use case for scope guards is making rollbackable code. But I see, this implementation doesn't support that.
bool rollback = true; // ...
BOOST_SCOPE_EXIT( (rollback) ) { if(rollback) do_rollback(); } BOOST_SCOPE_EXIT_END
// ... rollback = false; // commit
Yes, that is possible. Obviously, I didn't express myself well. I meant, it doesn't have a special support for it. What I was thinking is somewhat like this:
guard_stack transaction;
for (int i = 0; i < n; ++i) { do_smth(i); transaction.push(bind(&undo_smth, i)); }
transaction.commit();
IMHO, this looks a little more cute.
Although I admit such an addition to the library would be great, IMHO, this is outside the scope of the functionality planned here. Why not a Boost.Transaction library? What do you think? Hans
-- Best regards, Andrey mailto:andysem@mail.ru
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/ listinfo.cgi/boost