Using count_if with stl Map container class
Posted on 2007-10-12
I'm quite new to C++ and and could not find anything on the net via Google that can help me answer this question.
Suppose I have a map container declared as: map<int, state>
where state is an enum of three possible values.
I was wondering if I can use count_if to return the total number count for all pairs in the map where state = SOME_VALUE
Of course, I can create a trivial function to count this myself, but wanted to use a pre-existing algorithm from STL.