From: Howard Hinnant (hinnant_at_[hidden])
Date: 2003-06-10 10:52:59
On Tuesday, June 10, 2003, at 10:48 AM, Jan Gaspar wrote:
>> insert in general should have the basic exception safety guarantee.
>> But when inserting only one element at either end, the strong
>> is in place.
> I think the strong guarantee can reached only in case the
> cyclic_buffer is not
> full (if there is no reallocation).
You can do it with push_back/front too regardless. vector::push_back
has the strong guarantee. If you're using copy semantics (which I
would expect instead of move semantics), you basically have to build a
whole new vector in a temp (with the push_back), and then swap it in
when everything is set (just describing the realloc branch here).
If you're looking ahead to use move semantics to perform this
operation, it is a little more tricky, but not too much. In fact it is
easier with cyclic_buffer than it is with vector! :-) You have to
push_back the new element into the temporary first. If it throws, the
temporary cleans up the new buffer. If it doesn't, *then* move the old
data over (move must be nothrow).
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk