Why STL algorithm find() doesn't work on maps?
c++, dictionary, stl
Solution
- It does work on maps, but you need to compare against a `map::value_type` (which is `std::pair<const map::key_type, map::mapped_type>`), not the key type.
- Because map.find takes a key and returns a key/value pair iterator.
Problem
Is there any explanation why find() algorithm doesn't work for maps and one have to use map::find instead?