multiset max_size() in C++ STL with Examples Last Updated : 23 Jul, 2018 Comments Improve Suggest changes Like Article Like Report The multiset::max_size() is a built-in function in C++ STL which returns the maximum number of elements a multiset container can hold. Syntax: multiset_name.max_size() Parameters: The function does not accept any parameters. Return Value: The function returns the maximum number of elements a multiset container can hold. Below programs illustrate the above function: Program 1: CPP // CPP program to demonstrate the // multiset::max_size() function // when multiset is non-empty #include <bits/stdc++.h> using namespace std; int main() { multiset<int> s; // Function to insert elements // in the multiset container s.insert(10); s.insert(13); s.insert(13); s.insert(25); s.insert(24); cout << "The multiset elements are: "; for (auto it = s.begin(); it != s.end(); it++) cout << *it << " "; cout << "\nThe max size of multiset: " << s.max_size(); return 0; } Output: The multiset elements are: 10 13 13 24 25 The max size of multiset: 461168601842738790 Program 2: CPP // CPP program to demonstrate the // multiset::max_size() function // when multiset is empty #include <bits/stdc++.h> using namespace std; int main() { multiset<int> s; cout << "\nThe max size of multiset: " << s.max_size(); return 0; } Output: The max size of multiset: 461168601842738790 All functions of multiset Comment More infoAdvertise with us Next Article multiset max_size() in C++ STL with Examples gopaldave Follow Improve Article Tags : Misc C++ STL cpp-containers-library Practice Tags : CPPMiscSTL Similar Reads multiset size() in C++ STL with Examples The multiset::size() is a built-in function in C++ STL which returns the number of elements in the multiset container. Syntax: multiset_name.size() Parameters: The function does not accept any parameters. Return Value: The function returns the number of elements in the multiset container. Below prog 2 min read Multiset of Tuples in C++ with Examples What is a tuple? A tuple in C++ is an object which binds a group of elements together. The elements can be similar as well as different data types. The elements of tuples are initialized as in the order in which they will be accessed. Syntax: tuple<data_type1, data_type2, dataType3, ....> myTu 5 min read multiset max_size() in C++ STL The multiset::max_size() is an observer function in C++ STL which returns the maximum number of elements a container can hold. This limit might be due to system or library implementations. Being an observer function it does not modify the multiset in any way. Syntax: multiset_name.max_size() Paramet 1 min read Multiset of Pairs in C++ with Examples What is Multiset? A multiset is an associative container that can hold a number of elements in a specific order. Unlike a set, a multiset can contain multiple occurrences of the same element. Some of the functions associated with a multiset: begin(): Returns an iterator to the first element in the m 4 min read multiset lower_bound() in C++ STL with Examples The multiset::lower_bound() is a built-in function in C++ STL which returns an iterator pointing to the first element in the container which is equivalent to k passed in the parameter. In case k is not present in the set container, the function returns an iterator pointing to the immediate next elem 3 min read Multiset of Vectors in C++ with Examples What is Multiset? A multiset in C++ is an associative container that can hold a number of elements in a specific order. Unlike a set, a multiset can hold multiple copies of the same element. Functions associated with a multiset: begin(): Returns an iterator to the first element in the multiset.end() 4 min read forward_list max_size() in C++ STL with Examples The forward_list::max_size() is a built-in function in C++ STL which returns the maximum number of elements a forward_list container can hold Syntax: forward_list_name.max_size() Parameters: The function does not accept any parameters. Return Value: The function returns the maximum number of element 1 min read multiset upper_bound() in C++ STL with Examples The multiset::upper_bound() is a built-in function in C++ STL that returns an iterator pointing to the immediate next element which is just greater than k. If the key passed in the parameter exceeds the maximum key in the container, then the iterator returned points an element which points to the po 3 min read unordered_multiset max_size in C++ STL The max_size() of unordered_multiset takes the maximum number of elements that the unordered_multiset container is able to hold due to system or It gets the maximum size of the controlled sequence. Syntax: size_type max_size() const; where size_type is an unsigned integral type. Returns : The member 1 min read Like