C/C++ Arena

Step 3 of 5

A string-keyed map with erase

A map stores key/value pairs in the buckets instead of bare keys. Erasing finds the pair in its bucket and removes it from the list.

std::hash<std::string> hashes strings. (Under the hood it runs something like the FNV or MurmurHash functions over the bytes.)

Your turn: write StrMap (a fixed 64 buckets is fine here) with:

Previous: Load factor and rehashing Next: Hashing your own keys