Question

Is it a feature of unordered_map::find() to insert the key that we lookup with 0 value automatically? Let me make this clear

    unordered_map<int, int> tempMap;
    //some code
    if(tempMap.find(1) == tempMap.end()){
      //do something but not insert the 1 with a corresponding value into the tempMap
    }

so if I lookup 1 again, will it be there in the tempMap having 0 as corresponding value. Is that a feature of unordered_map?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top