web123456

Three insert insert methods for mapping maps in C++

Construct a map and insert a binary.

Method 1:

map<int, int> maps;
maps.insert(pair<int, int> (10, 15));

Method 2:

map<int, int> maps;
maps.insert(make_pair(10, 15));

Method 3:

map<int, int> maps;
typedef pair<int, int> Int_Pair;
maps.insert(Int_pair(10, 15));

Note: Compared with Method 3 and Method 1, the code form has changed, and the member usage is the same.