forward_list max_size() in C++ STL with Examples Last Updated : 23 Jul, 2018 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 elements the container can hold. Below programs illustrate the above function: Program 1: CPP // CPP program to demonstrate the // forward_list::max_size() function // when the list is not-empty #include <bits/stdc++.h> using namespace std; int main() { // declaration of forward list forward_list<int> fl; // assign value fl.assign(5, 8); // prints the elements cout << "The forward_list elements: "; for (auto it = fl.begin(); it != fl.end(); it++) cout << *it << " "; cout << "\nThe max size: " << fl.max_size(); return 0; } Output: The forward_list elements: 8 8 8 8 8 The max size: 1152921504606846975 Program 1: CPP // CPP program to demonstrate the // forward_list::max_size() function // when the list is empty #include <bits/stdc++.h> using namespace std; int main() { // declaration of forward list forward_list<int> fl; cout << "\nThe max size: " << fl.max_size(); return 0; } Output: The max size: 1152921504606846975 Comment More infoAdvertise with us Next Article multiset max_size() in C++ STL with Examples G gopaldave Follow Improve Article Tags : Misc C++ STL cpp-containers-library CPP-forward-list +1 More Practice Tags : CPPMiscSTL Similar Reads forward_list::cend() in C++ STL with Example forward_list::cend() is a function in C++ STL which returns a constant iterator pointing to the past-the-last element of the forward_list. The iterator returned by the function does not point to any element in the container, but to the position followed by the last element of the forward list contai 2 min read forward_list::max_size() in C++ STL std::forward_list::max_size() is an inbuilt function in CPP STL which returns the maximum number of elements can be held by forward_list. This value depends on system or library implementation. Syntax: forwardlist_name.max_size ()Parameters: The function does not accept any parameters. Return value: 1 min read 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 Set of List and Forward List in C++ with examples Sets Sets are a type of associative container in which each element has to be unique because the value of the element identifies it. The value of the element cannot be modified once it is added to the set, though it is possible to remove and add the modified value of that element. Functions used wit 4 min read multiset max_size() in C++ STL with Examples 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 multise 1 min read Forward List and List of Pairs in C++ with Examples Forward List Forward list in STL implements singly linked list. Introduced from C++11, forward lists are more useful than other containers in insertion, removal, and moving operations (like sort) and allow time constant insertion and removal of elements. It differs from the list by the fact that the 8 min read Like