In the previous recipe, we saw how string comparison can be optimized using hashing. After reading it, the following question may arise, "Can we make a container that will cache hashed values to use faster comparison?".
The answer is yes, and we can do much more. We can achieve almost constant time complexities for search, insertion, and removal of elements.
Basic knowledge of C++ and STL containers is required. Reading the previous recipe will also help.
This will be the simplest of all recipes:
<boost/unordered_map.hpp>header, if we wish to use maps or the
<boost/unordered_set.hpp>header, if we wish to use sets.