The std::unordered_map::operator is a built in function in C++ STL which returns the reference of value if key matches in the container. If no key is found then it inserts that key into container.
mapped_type& operator(key_type&& k);
Parameter: It takes parameter as key whose mapped value is accessed.
Return type: Returns a reference associated to that key.
5 : 6 3 : 4 1 : 2 10 : 0 1 : 2 5 : 0 3 : 2 25 : 0
c : 6 b : 4 a : 2 f : 0 a : 2 b : 2 c : 0 d : 0
Time Complexity O(n) in worst case.
- Why overriding both the global new operator and the class-specific operator is not ambiguous?
- set operator= in C++ STL
- new vs operator new in C++
- map::operator in C++ STL
- dot (.) operator in C/C++
- map operator= in C++ STL
- multiset::operator= in C++ STL
- multimap::operator= in C++ STL
- unordered_multimap operator= in C++ STL
- unordered_map operator= in C++ STL
- vector::operator= and vector::operator[ ] in C++ STL
- forward_list::operator= in C++ STL
- list::operator= in C++ STL
- array::operator[ ] in C++ STL
- deque::operator= and deque::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 firstname.lastname@example.org. 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.