Issues with unordered_map and unordered_multimap
Pavel P
pavlov.pavel@gmail.com
Fri May 20 02:47:00 GMT 2016
Hi,
I noticed that unordered_map with g++ (4.7 or 5.2) cannot be used with
forward declared types:
#include <unordered_map>
class test;
typedef std::unordered_map<int, test> test_map;
typedef test_map::iterator test_map_iterator; // <== error
here's error output: https://ideone.com/sy05RG
This same code works with std::map: https://ideone.com/poufNk
As far as I understand standard doesn't require that it would work,
still I think it would be nice that it worked similar to std::map. It
works ok with MSVC by the way.
The other issue is with unordered_multimap. Not sure what's going on
behind the scenes, but it was exceptionally slow in my case, and
unorderedmap::operator[] was taking like 80% of CPU in my app. I ended
up replacing it with unordered_map<lkey, list<value> > to solve it.
Any ideas?.
Thanks,
Pavel
More information about the Libstdc++
mailing list