现在的位置: 首页 > 综合 > 正文

map重复插入

2018年04月02日 ⁄ 综合 ⁄ 共 412字 ⁄ 字号 评论关闭

map重复插入,第二次插入的无效。

 

 

 

 

#include  "item_base.h"

#include  "test.h"

#include <string.h>

 

 

int main(void)

{

    map<int,int>temp;

    map<int,int>::iterator iter;

    temp.insert(make_pair(1,2));

    pair< map<int,int>::iterator , bool >pairtemp;

    pairtemp=temp.insert(make_pair(1,3));

    if(!pairtemp.second)

    {

        cout<<"this is map insert error!"<<endl;

    }

    iter=temp.begin();

    cout<<iter->first<<"/t"<<iter->second<<endl;

    return 0;

}

抱歉!评论已关闭.