From: Nigel Stewart (nigels_at_[hidden])
Date: 2003-07-27 19:39:32


> Wouldn't it be better to use smaller internal memory block initially and
> resize it only when demand goes up?

Pavel,

That's a good point, but it certainly complicates both the interface
and the semantics of the container. Could this style of circular
buffer be an adaptor, or perhaps a policy adaptor?

It's worth pointing out that std::vector also suffers this kind of
problem: clear() doesn't actually free any memory (at least on the
platforms I've worked with it on) - it's the programmers responsibility
to convince the container to release unused memory.

There was also some related dicussion in June in relation to a
re-allocating circular_buffer. (Howard Hinnant)

Nigel