The multiset container in C++ is a container that allows duplicate elements to be stored in a sorted order. The empty() function in the multiset class is used to check if the set is empty or not. If the set is empty, it returns true. Otherwise, it returns false.
Code Example:
```c++
#include
#include
int main() {
std::multiset myset;
// Check if set is empty
if (myset.empty())
std::cout << "Set is empty.\n";
else
std::cout << "Set is not empty.\n";
// Add elements to the set
myset.insert(10);
myset.insert(20);
myset.insert(30);
// Check if set is empty again
if (myset.empty())
std::cout << "Set is empty.\n";
else
std::cout << "Set is not empty.\n";
return 0;
}
```
In this example, we create an empty multiset and then use the empty() function to check if it is empty. Since it is empty, the output will be "Set is empty." Then, we add some elements to the set and check if it is empty again. Since it is not empty anymore, the output will be "Set is not empty."
Package/Library: The multiset is a part of the Standard Template Library (STL) in C++, which is included in the standard C++ library.
C++ (Cpp) multiset::empty - 29 examples found. These are the top rated real world C++ (Cpp) examples of multiset::empty extracted from open source projects. You can rate examples to help us improve the quality of examples.