
Jeremy Maitin-Shepard wrote:
Alberto Barbati <abarbati@iaanus.com> writes:
BTW, this discussion triggers some other ideas. Have you considered adding to the circular_buffer the capability to optionally notify the user about an impeding overwrite? I have at least one use case where it might be useful. It might be as easy as invoking a boost::function0 callback, at the cost of few bytes in footprint and an extra test before any overwrite. Alternatively, we could put hooks (in form of a template policy, for example) in the main container that are then implemented by a container adaptor, so the user won't pay if it doesn't want such a feature.
I would think that sort of feature would be better implemented as a wrapper around the circular_buffer container.
I tend to agree, in fact I mentioned container adaptor (= wrapper) in the list of alternatives. I guess such an adaptor could perform the task more efficiently if the underlying container provided the right hooks, but until we agree on the semantic and have a reasonable test implementation it's difficult to tell. Alberto