The multimap clear() function is an inbuilt function in C++ STL which is used to remove all elements from the multimap container (which are destroyed), leaving the container with a size of 0.
Parameters: This function does not take any arguments.
Return Value: This function does not returns anything. The return type of the function is void. It just empties the whole container.
Below program illustrate the multimap::clear() function in C++:
Size of the multimap before using clear function : 3 Size of the multimap after using clear function : 0
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.