[Patch] libstdc++/23425

Paolo Carlini pcarlini@suse.de
Fri Nov 4 09:38:00 GMT 2005


Hi,

> clear() is best not thought of as a special case of erase().  It is 
> best thought of as a special case of a private function which I'll call:
>
> void __erase_at_end(size_type n);
>
> Erases the last n elements from the vector.  This is needed in the 
> following public members of vector:
>
> All forms of assign.
> All forms of erase.
> All forms of resize.
> clear.

Howard, makes sense to you that essentially the same optimization is
possible for std::deque? I'm looking at the code and, besides the
additional complexity of freeing the nodes, it seems everything is very,
very similar. I can work on that too in the branch.

Paolo.



More information about the Libstdc++ mailing list