Why does C++11/Boost `unordered_map` not rehash when erasing?
问题 I'm wondering why both C++11 and Boost's hashmap does not resize while erasing elements through iteration. Even if that is not technically a memory leak I think it could be a serious issue in applications (it was a hidden issue for me, had hard time to track it back) and it could actually affecting many applications. Is this a "design flaw" with the container? I benchmarked it and seems to be affecting several compiler releases (including VS, Clang, GCC) The code to reproduce the issue is: