Map in STL Maps are associative containers that store elements in a mapped fashion. Each element has a key value and a mapped value. No two mapped values can have same key values.
Vector in STL Vector is same as dynamic arrays with the ability to resize itself automatically when an element is inserted or deleted, with their storage being handled automatically by the container. Vector elements are placed in contiguous storage so that they can be accessed and traversed using iterators.
Map of Vectors in STL: Map of Vectors can be very efficient in designing complex data structures.
map<key, vector<datatype>> map_of_vector; OR map<vector<datatype>, key> map_of_vector;
For example: Consider a simple problem where we have to check if a vector is visited or not.
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.
- Vector of Vectors in C++ STL with Examples
- Array of Vectors in C++ STL
- How to join two Vectors using STL in C++?
- Working with Array and Vectors using STL in C++
- Quickly check if two STL vectors contain same elements or not
- Difference between std::remove and vector::erase for vectors
- Implementation of file allocation methods using vectors
- How to flatten a Vector of Vectors or 2D Vector in C++
- cin get() in C++ with Examples
- std::less in C++ with Examples
- Pi(π) in C++ with Examples
- std::remove_const in C++ with Examples
- std::is_heap( ) in C++ with Examples
- wmemset() in C/C++ with Examples
- feclearexcept in C++ with Examples
- std::equal_to in C++ with Examples
- std::is_copy_constructible in C++ with Examples
- std::unary_negate() in C++ with Examples
- C/C++ For loop with Examples
- C/C++ if else statement with Examples
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 Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.