Hi.
How do you know if find() returns a valid element in a map that is inside a map? For example:
Given the example above, how do you know what if the search in the second map container (map inside of map) points to a valid element?Code:typedef std::map<int, int> mapIntInt; typedef std::map<double, mapIntInt> mapDM; mapIntInt mapOne; mapOne.insert(std::pair<int, int>(0, 1)); mapDM mapTwo; mapTwo.insert(std::pair<double, mapIntInt>(8.9, mapOne)); // Now I want to search mapOne, but first I need to search mapTwo for mapOne. if (twoIterator != mapTwo.end()) { oneIterator = twoIterator->second.find(8.9); // How do you check if oneIterator points to a valid element? }
Thanks,
Kuphryn



LinkBack URL
About LinkBacks


