Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Maps in C++ - std-map and std-unordered_map

The Cherno via YouTube

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

Reviews

Start your review of Maps in C++ - std-map and std-unordered_map

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.