如何使用地图的指针获取地图的大小
how to get the size of the map using the pointer of the map?
我有一个问题,如何使用指向地图的指针来获取地图的大小:
map<int, string> mapList;
map<int, string>* getMapList()
{
return &mapList;
}
void main()
{
map<int, string>* mapPointer = getMapList();
}
那么如何使用这个pointer
来获取map
的大小呢?
在指针上调用size
函数
mapPointer->size()
mapPointer->size()
会给你尺寸。
相关文章:
- 如何遍历多个地图并获取它们的值? - C++
- 无法从地图获取key_type
- 无法调用未来::获取存储在地图中的未来
- 通过关键点向量从地图中获取地图
- 如何获取地图值的参考?
- 如何获取特定范围内的地图lower_bound?
- C++获取地图的关键字
- 如何获取地图中向量的第二个值?
- 获取地图值作为向量的最佳方法是什么
- 通过参考从地图获取对象
- 合成地图:从另一个地图获取数据
- 从地图中获取所有值
- 无序地图 - 使用const键获取值
- "Error: expected a '{' introducing a lambda body"尝试从地图<字符,字符中获取字符时> C++
- OSX "ld" : 如何显示未解析符号的损坏名称?如何获取地图文件?
- 获取与地图中查询相匹配的所有键
- 特征 - 从地图获取矩阵
- 程序在尝试获取地图值时崩溃
- 在不知道的情况下获取地图的钥匙
- 从文件中获取偏移量和大小以存储在地图中