日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

stl中map函数_map :: max_size()函数,以及C ++ STL中的Example

發(fā)布時間:2025/3/11 编程问答 47 豆豆
生活随笔 收集整理的這篇文章主要介紹了 stl中map函数_map :: max_size()函数,以及C ++ STL中的Example 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

stl中map函數(shù)

C ++ STL映射:: max_size() (C++ STL map::max_size() )

It returns the maximum number of elements the container(map) is able to hold but at runtime, the size of the container may be limited to a value smaller than specified by max_size() by the amount of RAM available. It gives us an only a theoretical limit on the size of the container.

它返回容器(映射)能夠容納的最大元素數(shù)量,但是在運行時,容器的大小可能會限制為小于可用max_size()指定的可用RAM數(shù)量的值。 它僅對容器的大小提供了理論上的限制。

Syntax:

句法:

myMap.max_size()

Where, myMap is the object of class map.

其中, myMap是類映射的對象。

Parameters: None - It does not accept any parameters.

參數(shù):無-不接受任何參數(shù)。

Return value: It simply returns the maximum number of elements container can hold.

返回值:它僅返回容器可以容納的最大元素數(shù)。

Example:

例:

#include <bits/stdc++.h> using namespace std; int main() { // create map container map<int, int> myMap;//insert an element in mapmyMap.insert( pair<int, int>(200 , 100) ); cout<<"max size of Non-empty map : \n"; cout << "The max size of myMap is " << myMap.max_size();map<char,char> EmpMap;map<int, int> EmpMap2; cout<<"max size of Empty-map : \n"; cout << "\nThe max size of EmpMap is " << EmpMap.max_size();cout << "\nThe max size of EmpMap2 is " << EmpMap2.max_size();return 0; }

Output

輸出量

max size of Non-empty map : The max size of myMap is 461168601842738790max size of Empty-map :The max size of EmpMap is 461168601842738790 The max size of EmpMap2 is 461168601842738790

翻譯自: https://www.includehelp.com/stl/map-max-size-function-with-example-in-cpp-stl.aspx

stl中map函數(shù)

總結(jié)

以上是生活随笔為你收集整理的stl中map函数_map :: max_size()函数,以及C ++ STL中的Example的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。