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
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- Why overriding both the global new operator and the class-specific operator is not ambiguous?
- Operator Overloading '<<' and '>>' operator in a linked list class
- map::operator in C++ STL
- dot (.) operator in C/C++
- set operator= in C++ STL
- new vs operator new in C++
- unordered_set operator= in C++ STL
- match_results operator= in C++
- match_results operator in C++ STL
- multiset::operator= in C++ STL
- multimap::operator= in C++ STL
- vector::operator= and vector::operator[ ] in C++ STL
- array::operator[ ] in C++ STL
- deque::operator= and deque::operator in C++ STL
- list::operator= 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.