How do you use find with a const_iterator if you have a map defined as
typedef std::pair<int, int> MyPair;
map<MyPair, int> MyMap;
with the pair defined as the key.
If it was just map<int, int>, I know how to use a const_iterator like
typedef map<int, int> MyMap;
MyMap::const_iterator it =
MyMap.find(0);
// etc..
If you are not using C++11, the most convenient is to also do a
typedeffor the map type:And then
(I also changed the parameter passed to
find, as a bareintis not compatible with your map).If you are using C++11, you can also do simply