Patch: stl_vector.h
Matt Austern
austern@apple.com
Sat Oct 16 18:35:00 GMT 2004
On Oct 16, 2004, at 3:37 AM, Dhruv Matani wrote:
> On an unrelated note, would we be interested in providing support for
> stateful allocators in gcc4?
Don't we provide it already? Perhaps you mean something by "support
for stateful allocators" than I do, but _Vector_base squirrels away a
copy of the allocator the user provided, all the allocator operations
dispatch to that copy, and get_allocator returns another copy of it.
To me that seems like we're preserving and using state.
>
> Also, one more thing that comes to mind is the O(N) complexity of
> std::list::size(). Should we provide an option of choosing the
> complexity? I'm asking this because I've found myself using list and
> then also maintaining a separate counter for fast size lookup.
I wouldn't be strongly opposed to changing the complexity to O(1)
(slightly opposed, since it makes other operations slower and I
think those other operations are more important), but I would be
strongly opposed to making it an option. Any mechanism I can
think of for making this a user option would either slow things
down, or cause compatibility problems, or both. We should make
a definite choice and stick to it. The wrong choice (whichever
choice one thinks that is) is better than no choice.
--Matt
More information about the Libstdc++
mailing list