=====empty=====
Syntax:
#include
bool empty() const;
The empty() function returns true if the set has no elements, false otherwise.
For example, the following code uses empty() to determine if a set is empty:
// Create a set of characters
set charSet;
cout << (charSet.empty() ? "EMPTY " : "NON-EMPTY ");
charSet.insert( 'A' );
charSet.insert( 'B' );
charSet.insert( 'C' );
cout << (charSet.empty() ? "EMPTY " : "NON-EMPTY ");
charSet.clear();
cout << (charSet.empty() ? "EMPTY " : "NON-EMPTY ");
// output is "EMPTY NON-EMPTY EMPTY "
Related Topics: [[size]]