덮어 쓰지 않습니다 m.insert(p2)
지도에서 이전 개체를 덮어 쓰지 않는 이유, Map value: 1
: 그것은 인쇄왜 C++ map.insert() 아래의 코드에서
#include <map>
#include <utility>
#include <iostream>
using namespace std;
int main(){
pair<int,int> p1(1,1);
pair<int,int> p2(1,2);
map<int,int> m;
m.insert(p1);
m.insert(p2);
cout << "Map value: "<< m.at(1) << endl;
}
를? std::map::insert 참조하면
예상되는 동작입니다. – CoryKramer
그게 "삽입하다"라는 뜻입니다. –