map容器的使用

1、map是STL容器中的一种,属于关联性容器。
以key value的形式存储。key必须唯一。如果重复则插入失败。插入后按照key默认排序。必须要先声明命名空间

using namespace std;

2、例如:

#include<map>
#include<string>
using namespace std;
void main()
{
map<int,string>h;
}
posted @ 2016-10-23 11:12  朝_风  阅读(303)  评论(0编辑  收藏  举报