Nigel Stewart wrote: > To summarise: > > Possible resize policies: > > i. Capacity is fixed at compile time. > ii. Capacity is fixed at construction time. > iii. Capacity can be manually managed by client code. > iv. Capacity is allowed to grow automatically. (ala std::vector) > > Possible insert handling policies: > > I. Insert into full buffer results in no change. > II. Insert into full buffer results in overwriting opposite end. > Insertion into arbitrary position overwrites beginning, if necessary. > III. Insert into full buffer results in exception. > > Possible resize to smaller capacity policies: > > 1. Keep left-most items. (ala std::vector) > 2. Keep right-most items. > > The general gist of some random googling on "circular buffers": > > - Automatic resizing does not appear to be common. > - No established convention in relation to arbitrary insert. > - No established convention in relation to resizing to smaller capacity.
Another distinction might be 'black box / white box', i.e. whether you have public access to the iterators. If you are merely using a fixed, circular buffer to stop your queue/stack reallocating, you may want to hide them. This is a relatively minor detail. Something I would address in a policy-based implementation, but not in the 'best generalisation for common cases'. -- AlisdairM _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost