Overview
Explore the fundamentals and advanced usage of maps in C++, focusing on std::map and std::unordered_map. Learn about the purpose and benefits of maps, implement custom hash functions for user-defined types, and master key operations such as insertion, retrieval, and deletion. Discover how to iterate through maps, check for key existence, and create less-than operators for custom types. Gain insights into performance considerations and guidelines for choosing between different map types to optimize your C++ programs.
Syllabus
- What are maps?
- Why use maps + example usage
- Writing a hash function to use a custom type
- The [] operator
- The .at function
- How to check if key exists in map
- How to iterate through maps
- How to remove entries from maps
- Writing a less-than operator for custom types
- Performance and which map to use
Taught by
The Cherno