Reputation: 37928
I have a std::unordered_map
that I emplace()
an object to via:
my_map.emplace(std::piecewise_construct,
std::forward_as_tuple(key),
std::forward_as_tuple(value1, value2));
This fails at some point during runtime with a false
in the second position of the returned tuple. Is there a way to get more information about what's going on? top
doesn't show any trouble with memory.
Upvotes: 2
Views: 2686
Reputation: 171177
A false
in .second
means "equivalent element already present." In such case, the iterator in .first
points to that equivalent element.
So what's happening is that you already have key
in the map, and you can use .first
on the return value to access it.
Upvotes: 12