Boost logo

Boost :

From: Pavel Vozenilek (pavel_vozenilek_at_[hidden])
Date: 2004-03-08 19:17:00


"Alberto Barbati" <abarbati_at_[hidden]> wrote

[snip assignement prefereble over destruct/construct]

> 2) with the dtor/ctor idiom, if the ctor throws an exception, the old
> element is lost and you can't do anything about it, so the container
> cannot provide more than the basic guarantee for any method that might
> overwrite elements. However, the user might implement assigment with the
> strong guarantee, the container might leverage on that and provide the
> strong guarantee too at least for methods that might overwrite a single
> element such as push_back/push_front. (Of course, the user might
> implement assignment so badly that it doesn't provide even the basic
> guarantee and the container could not recover from that, but a library
> such not try to outsmart the user... too much ;).
>
This argument isn't valid.

push_back() will construct elements when there's space
available in circular buffer.

Therefore using assignement won't give the method
strong guarantee (in all cases).

/Pavel


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