It doesn't overwrite. However if you check the return value, there is a std::pair
. If bool is true, then it was inserted. If the bool is false, then it was not inserted because of a collision. At that point, you can then overwrite the data yourself by writing to the iterator.