map的坑

 
  
#include
#include
using namespace std;
int main(){
    std::unordered_map mm;
    mm[3];
    mm.insert(pair(1,2));
    mm.insert(pair(1,5));
    mm.insert(pair(2,3));
    for(auto it = mm.begin(); it != mm.end();it ++ ){
        cout << it->first << " : " << it->second << endl;
    }
    return 0;
}

1.[]操作符
2.map特性:Inserts element(s) into the container, if the container doesn't already contain an element with an equivalent key.

 
 

你可能感兴趣的:(一步一步CPP)