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
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:
The forward_list elements: 8 8 8 8 8 The max size: 1152921504606846975
The max size: 1152921504606846975
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.
- multimap maxsize() in C++ STL
- multiset lower_bound() in C++ STL with Examples
- multiset upper_bound() in C++ STL with Examples
- multiset max_size() in C++ STL with Examples
- array data() in C++ STL with Examples
- multiset size() in C++ STL with Examples
- unordered_set get_allocator() in C++ STL with Examples
- not1 and not2 function templates in C++ STL with Examples
- fill() function in C++ STL with examples
- fill_n() function in C++ STL with examples
- Vector of Vectors in C++ STL with Examples
- Map of Vectors in C++ STL with Examples
- Stack of Pair in C++ STL with Examples
- Queue of Pairs in C++ STL with Examples
- std::sort() in C++ STL
- Kruskal's Minimum Spanning Tree using STL in C++
- Dijkstra’s shortest path algorithm using set in STL
- Dijkstra's Shortest Path Algorithm using priority_queue of STL
- Prim's algorithm using priority_queue in STL
- unordered_map in C++ STL
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.