C ++ STL中的multiset max_size()示例
在本教程中,我们将讨论一个程序,以了解C++STL中的多集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
热门推荐
10 到同事新家简短祝福语
11 锡婚祝福语简短霸气
12 结婚喜庆的祝福语简短
13 职场祝福语大全 简短精辟
14 给宝贝开学祝福语简短
15 十月简短祝福语
16 女朋友考试祝福语简短
17 元旦联谊祝福语简短精辟
18 姐妹结婚快乐祝福语简短