Boost logo

Boost :

From: Neil Groves (neil_at_[hidden])
Date: 2008-01-21 09:13:59


You are correct.

The default capacity would be better as 0. I had misunderstood the default
capacity arrangement.

Neil Groves

On Jan 21, 2008 1:32 PM, Thorsten Ottosen <thorsten.ottosen_at_[hidden]>
wrote:

> Neil Groves skrev:
> > I am happy that you are not suggesting allocation in the push operation.
> >
> > I think that requiring a call to reserve() is surprising behaviour since
> one
> > would have to call reserve() for the container to work. This is
> inconsistent
> > with the standard containers in a different manner. I have always wanted
> my
> > circular_buffer uses to be allocated at full size.
>
> But isn't that 2^32 objects (i.e. *huge*)? (Or am I misunderstanding
> something?)
>
> > Perhaps the default
> > behaviour could remain the same but an additional constructor could be
> > provided to avoid allocation during construction?
>
> Hm. I don't know. There is a lot of existing code that relies on cheap
> default construction, e.g.:
>
> std::map<int,circular_buffer<T>> map;
> map[ 1 ] = circular_buffer<T>(...);
>
> -Thorsten
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>


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