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.
empty() function is used to check if the map container is empty or not.
mapname.empty() Parameters : No parameters are passed. Returns : True, if map is empty False, Otherwise
Input : map mymap['a']=10; mymap['b']=20; mymap.empty(); Output : False Input : map mymap.empty(); Output : True
Errors and Exceptions
1. It has a no exception throw guarantee.
2. Shows error when a parameter is passed.
Time Complexity : O(1)
- Different ways to use Const with Reference to a Pointer in C++
- std::to_address in C++ with Examples
- Program to create Custom Vector Class in C++
- std::is_trivially_copy_constructible in C/C++
- Difference between Python and C++
- tgamma() method in C/C++ with Examples
- boost::type_traits::is_array Template in C++
- boost is_pointer template in C++
- Stack of Pair in C++ STL with Examples
- Modulo Operator (%) in C/C++ with Examples
- fpclassify() method in C/C++ with Examples
- Operator Overloading '<<' and '>>' operator in a linked list class
- How to find the Entry with largest Value in a C++ Map
- Visibility Modes in C++ with Examples
- Program to implement Separate Chaining in C++ STL without the use of pointers
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.