Boost logo

Boost :

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


"David Abrahams" <dave_at_[hidden]> wrote

> I still see no a priori reason that circular_buffer must do element
> destruction before it is itself destroyed. std::vector *has* to do
> some destruction in order to get the right semantics. Arguably,
> circular_buffer does not. If it doesn't matter *which* vector
> elements get destroyed upon erase, then I presume it doesn't matter
> which circular_buffer elements get destroyed. In that case, why
> should it matter that any elements are destroyed?
>
If you have class and the class has static member keeping
number of object instances alive (incremented in constructor,
decremented in destructor):

 - putting these objects into vector keeps counter valid,
 - circular_buffer with assignement won't.

That was problem I did have with earlier version of
circular_buffer and that' why I did ask for construct/destruct
feature.

It is maybe border case but IMHO valid one against assignement.

/Pavel


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