I seen a post in here that you could "meet with the Birthday problem." while using std::unordered_map
When should I use unordered_map and not std::map
Which really surprises me, that is the same that saying std::unordered_map
is unsafe to use. Is that true? If i'm not explaining myself, let me show you an example:
unordered_map<size_t, size_t> m;
for (size_t i = 0; i < 100; ++i)
m[i] = i;
for (size_t i = 0; i < 100; ++i)
if (m[i] != i)
cerr << "ERROR!" << endl;
If this code is in main
, is there any possibility that it prints ERROR!
?