C++98 | size_type size() const; |
// map::size #include <iostream> #include <map> int main () { std::map<char,int> mymap; mymap['a']=101; mymap['b']=202; mymap['c']=302; std::cout << "mymap.size() is " << mymap.size() << '\n'; return 0; } |
map::empty | 测试容器是否为空(公众成员函数) |
map::max_size | 返回最大元素个数(公众成员函数) |