The map::operator= is a built function in C++ STL which assigns contents of a container to a different container, replacing its current content.
map1_name = map2_name
Parameters: The map on the left is the container in which the map on the right is to be assigned by destroying the elements of map1.
Return Value: This function does not return anything.
The map mp is : KEY ELEMENT 1 40 2 30 4 50 The map copymap is : KEY ELEMENT 1 40 2 30 4 50
Rated as one of the most sought after skills in the industry, own the basics of coding with our C++ STL Course and master the very concepts by intense problem-solving.
- map::at() and map::swap() in C++ STL
- map::operator in C++ STL
- vector::operator= and vector::operator[ ] in C++ STL
- deque::operator= and deque::operator in C++ STL
- Searching in a map using std::map functions in C++
- Inserting elements in std::map (insert, emplace and operator )
- Operator overloading in C++ to print contents of vector, map, pair, ..
- Why overriding both the global new operator and the class-specific operator is not ambiguous?
- Operator Overloading '<<' and '>>' operator in a linked list class
- 3-way comparison operator (Space Ship Operator) in C++ 20
- Descending order in Map and Multimap of C++ STL
- Map in C++ Standard Template Library (STL)
- Hash Table vs STL Map
- Map of pairs in STL
- 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::at() in C++ STL
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.