Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
multiset max_size() in C++ STL with Examples
In this tutorial, we will be discussing a program to understand multiset max_size() in C++ STL.
The function max_size() returns the maximum number of elements a given container can hold.
Example
#include <bits/stdc++.h>
using namespace std;
int main(){
multiset<int> s;
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
Advertisements