This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: debug unordered_multi erase patch


On 11/26/2010 11:47 PM, Paolo Carlini wrote:
Il 26/11/10 21.47, François Dumont ha scritto:
Hi

debug unordered_multimap and unordered_multiset erase from key are not correctly implemented and no test was showing this problem.
Ok. A minor nit would be that normally - outside a special case in std::list if I remember correctly - in the library we *never* postincrement iterators for performance reasons: agreed, given today's optimizers, in particular for the pretty simple iterator types of the std containers, probably this traditional general rule of thumb isn't so important anymore, but let's stick to it for now (actually, as matter of style, we don't postincrement *anything*, just in case you didn't notice already, not even integers)

Please post what you actually will end up committing (and its ChangeLog entry)

Thanks
Paolo.
I know that as much as possible we should use pre-increment but in this case I really need post-increment. Do you mean that I should have introduce an intermediate copy ? This is finally what is done in the post-increment operator so there would be no performance benefit, no ?

Attached patch applied:

2010-11-27 François Dumont <francois.cppdevs@free.fr>

* include/debug/unordered_map (unordered_multimap<>::erase): Fix to
erase all elements associated to the key.
* include/debug/unordered_set (unordered_multiset<>::erase): Likewise.
* testsuite/23_containers/unordered_multimap/erase/1.cc: Modify to
check for multiple erase.
* testsuite/23_containers/unordered_multiset/erase/1.cc: Likewise.


François

Attachment: unordered_multi_erase.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]