Boost logo

Boost :

From: JOAQUIN LOPEZ MU?Z (joaquin_at_[hidden])
Date: 2004-04-12 15:55:23

----- Mensaje original -----
De: Robert Ramey <ramey_at_[hidden]>
Fecha: Lunes, Abril 12, 2004 9:13 pm
Asunto: Re:Re: [boost] Re: Seriialzation library draft # 18 uploaded to filesection

> Joaqumn M Lspez Muqoz wrote:
> > push_back() can also throw from the allocator if it runs out of
> memory,> so you really need some proper clenaup regardless of the
> guarantees> made by copying ops. Dave's suggestion of using RAII
> is probably the
> > most elegant way to deal with the situation: in my experience,
> however,> this sort of scope guards perform worse than a
> try{}catch(...){}. Your
> > mileage may vary.
> Anything wrong with the following?
[code rewritten using new stack_construct facility]

It looks fine to me. Also, please ignore my previous
statement about the relative merits of try{}catch(...){}
wrt to RAII. The performance gain of the former shows
only, it seems to me, when using scope guards. In your case,
in which destruction *always* takes place, I doubt anything
can beat what you've just written.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo

Boost list run by bdawes at, gregod at, cpdaniel at, john at