Associative Containers: Performance Comparison
Explore the performance differences between std::map and std::unordered_map in C++. Understand their access times, ordered versus unordered key/value associations, and see practical tests with a large phone book dataset.
We'll cover the following...
We'll cover the following...
In 95% of our use-cases, we use std::map or std::unordered_map. In fewer cases, we do not need the value associated with the key. Before we begin this lesson and give an overview of numbers to both associative containers, here is one simple rule to remember:
If we want to have a container with ordered key/value associations, use
std::map; if not, use astd::unordered_map.
A Phone Book
The eight variations are like different versions of a phone book. What is a phone book? A phone book is a sequence of ...