Boost logo

Boost :

From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2008-01-21 05:40:23


Hi Jan,

#1
I was browsing through the docs in trunk. First I noticed that the
default constructor has the follwoing postcondition:

   capacity() == max_size() && size() == 0

I find that somewhat unfortunate that it allocates a huge amount of
memory. It seems to me that it is too easy to do that by coincidence.
The usual rule for std containers is to never allocate by default and
anticipate a call to reserve() or the first element. It also seems to me
that this will create problems when the container is used in containers
that might use default construction.

#2
I think it would be useful to add a predicate called is_linearized(), so
one can check if this property holds. Also, if this do hold, I should be
able the get fast iterators to this linear segment, perhaps by calling
.base() on the iterators which then simply return a pointer
(I know I can get the pointers by array_one(), but I would more often
need the iterators).

#3
I think it would be useful to add rotate() as a member function. AFAICT,
it can in many times (if not all) be much faster than std::rotate()
because it can simply move a few elements and then simply adjust the
iterators.

-Thorsten


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