#include
bool empty() const;
The empty() function returns true if the multiset has no elements, false
otherwise.
For example, the following code uses empty() as the stopping condition on a while loop to clear a multiset and display its contents in reverse order:
multiset ms;
for( int i = 0; i < 5; i++ ) {
ms.insert(i);
}
while( !ms.empty() ) {
multiset::iterator iter = ms.end();
iter--;
cout << *iter << endl;
ms.erase( iter );
}
Related Topics: [[size]]