I have two maps which I want to compare based on values. The maps are of type:
std::map<std::string, CustomMap> compareMap;
where CustomMap is:
std::map<std::string, Struct> CustomMap;
and Struct is a struct of two strings. This is how the design is and I can't change it.
How do I efficiently compare two compareMaps based on their values? The only way I can think of now is to use 2 for loops. Is there some inbuilt way to compare the maps based on their values? Or some way to calculate the hash on the values and find out which entries differ and which entries are the same?
EDIT: Let me rephrase my question: Is there a better elegant way to compare the maps based on their values instead of using two for-loops? I know the maps are different and some keys have the same values in both the maps. I only want to know which keys have different values in the two maps.
P.S: I don't have C++11