From: Doug Gregor (gregod_at_[hidden])
Date: 2001-02-27 16:14:17
On Tuesday 27 February 2001 03:33, Beman Dawes wrote:
> At 02:08 PM 2/27/2001 -0500, Doug Gregor wrote:
> >On Tuesday 27 February 2001 01:49, boost_at_[hidden] wrote:
> >> Actually, neither of these is what I'm looking for.
> >Why not supply a traits class to determine what to do when the buffer is
> >full? Then the decision is left to the user.
> That starts to get interesting.
> What else should be parameterized? The underlying container?
Yes, the circ_buffer would also need to be parameterized based on the
underlying container. I hadn't meant the example as a complete description of
circ_buffer, but merely to illustrate one possible resolution of the need for
differing behaviors on overflow.
IMHO, more containers should have been designed with such a trait class in
mind. The doubling of size when a std::vector overflows, though giving a good
constant amortized time for push_back(), is undesirable in many applications
- it shouldn't require subclassing or wrapping std::vector to change this
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk