Why C++ map.insert() doesn't overwrite

前端 未结 5 1373
误落风尘
误落风尘 2021-01-17 20:25

In the code below:

#include 
#include 
#include 

using namespace std;

int main(){
  pair p1(1,1);
         


        
5条回答
  •  有刺的猬
    2021-01-17 21:02

    This is supposed to happen. map.insert() will only insert elements into the container if it doesn't already contain any elements, so this will ignore the later value elements assigned to it.

提交回复
热议问题