public member function
<map>
std::map::emptybool empty() const noexcept;
Test whether container is empty
Returns whether the map container is empty (i.e. whether its size is 0).This function does not modify the container in any way. To clear the content of a map container, see map::clear.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// map::empty
#include <iostream>
#include <map>
int main ()
{
std::map<char,int> mymap;
mymap['a']=10;
mymap['b']=20;
mymap['c']=30;
while (!mymap.empty())
{
std::cout << mymap.begin()->first << " => " << mymap.begin()->second << '\n';
mymap.erase(mymap.begin());
}
return 0;
}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4