Boost logo

Boost :

From: Hillel Y. Sims (hsims_at_[hidden])
Date: 2002-09-30 11:10:25


"Peter Dimov" <pdimov_at_[hidden]> wrote in message
news:013201c26890$5968b990$1d00a8c0_at_pdimov2...
>
> vs.
>
> {
> transaction t1 = do_push_back(vector1, e1);
> transaction t2 = do_push_back(vector2, e2);
> transaction t3 = do_push_back(vector3, e3);
> // ...
> t1.commit();
> t2.commit();
> t3.commit();
> // ...
> }
>
[..]
>
> ... but at some point the overhead of writing do_push_back is amortized
and
> do_push_back wins against "raw" ScopeGuard.
>

Agreed, but when comparing between "once-off" try/catch/re-throw blocks vs.
ScopeGuard, I will personally attempt/recommend to use ScopeGuard first and
only fall-back to try/catch/re-throw if that absolutely fails (which is
really not very often). Pure RAII is "best", but typically requires a
slightly higher initial investment.

hys

--
Hillel Y. Sims
FactSet Research Systems
hsims AT factset.com

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