Boost logo

Boost :

From: Fredrik Blomqvist (f_blq_at_[hidden])
Date: 2002-09-27 10:39:22


Fernando Cacciola (hotmail) wrote:
> Consider this example of "synchronized multiple
> updates"
[...]
> The goal is to achieve the basic guarantee for the
> synchronized push_back.
>
> How would you do this?
> (Without copying the whole thing just to move the
> final state at the end, of course)

David Abrahams wrote:
[...]
> {
> vector1.push_back(e1);
> try {
> vector2.push_back(e2):
> }
> catch(...) {
> vector1.pop_back();
> throw;
> }

Isn't this a good example of something scopeguard +
bind/lambda would be well suited to handle?
 IIRC Alexandrescu & Marginean's original CUJ article
about scopeguard investigated a case very similar to
this.

So, my next questions is: What is the status of the
proposed boost::scope_guard?
Will it show up in the utils (soon)?
 I think scopeguard (and preferrably also janitor) in
the form Joe Swatosh posted a while ago would be very
suitable for inclusion in boost.

Just my 2c
/Fredrik Blomqvist

__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com


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