This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [Patch] libstdc++/23425
Paolo Carlini wrote:
>Hi,
>
>>lear() 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.
>
>
+ understandably, an _M_erase_at_begin could be expected...
However I'm not sure that it would find as many uses, besides the
implementation of erase(iterator, iterator)...
Paolo.