이 튜토리얼에서는 C++ STL에서 multiset max_size()를 이해하는 프로그램에 대해 논의할 것입니다.
max_size() 함수는 주어진 컨테이너가 보유할 수 있는 최대 요소 수를 반환합니다.
예
#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;
} 출력
The multiset elements are: 10 13 13 24 25 The max size of multiset: 461168601842738790