Map in STL is used to hash key and value. We generally see map being used for standard data types. We can also use map for pairs.
For example consider a simple problem, given a matrix and positions visited, print which positions are not visited.
(0, 1) (0, 2) (1, 2) (2, 0) (2, 1)
This article is contributed by Abhishek Rajput. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- map::at() and map::swap() in C++ STL
- Searching in a map using std::map functions in C++
- Descending order in Map and Multimap of C++ STL
- Map in C++ Standard Template Library (STL)
- Hash Table vs STL Map
- Traversing a map (or unordered_map) in C++ STL
- map::clear() in C++ STL
- map::size() in C++ STL
- map::begin() and end() in C++ STL
- map::empty() in C++ STL
- map::operator in C++ STL
- map::at() in C++ STL
- Default values in a Map in C++ STL
- set vs map in C++ STL
- map emplace() in C++ STL
- map cbegin() and cend() function in C++ STL
- map crbegin() and crend() function in C++ STL
- map max_size() in C++ STL
- map upper_bound() function in C++ STL
- map operator= in C++ STL