Boost logo

Boost :

From: Alexander Nasonov (alnsn_at_[hidden])
Date: 2007-04-09 02:46:24


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

-- 
Alexander Nasonov
http://nasonov.blogspot.com
What would men be without women? Scarce, sir, mighty scarce. --
Mark Twain --
This quote is generated by: 
	/usr/pkg/bin/curl -L http://tinyurl.com/veusy         \
	  | sed -e 's/^document\.write(.//' -e 's/.);$/ --/'  \
	        -e 's/<[^>]*>//g' -e 's/^More quotes from //' \
	  | fmt | tee ~/.signature-quote

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