A.B.
A.B.

Reputation: 16630

Does std::unordered_map use hashes internally?

Given

std::unordered_map<std::string, sf::Texture> container;

will

container["myKey"] = myTexture;

transform "myKey" into a hash behind the scenes?

If so, are duplicate hashes possible?

Upvotes: 2

Views: 146

Answers (1)

NPE
NPE

Reputation: 500327

Yes, it does.

No, hashes don't have to be unique: if two keys hash to the same value, the keys themselves have to be compared to establish whether or not they are equal.

Upvotes: 2

Related Questions