jeudi 5 octobre 2017

Comparing keys and values maps C++

I have two maps. I need to compare both keys and values.

map<char,int> mymap;
mymap.insert(pair<char,int>('a',1));
mymap.insert(pair<char,int>('c',2));

map<char,int> mymap1;
mymap1.insert(pair<char,int>('b',1));
mymap1.insert(pair<char,int>('d',2));

Example key "a" from "mymap" is compared with "b","d" in "mymap1"

If same key found in other mymap1 i need to compare the values.

So I need to compare keys and values. How can i do that in c++

Aucun commentaire:

Enregistrer un commentaire