| 668 | // the given predicate. |
| 669 | template <class Container, typename Predicate> |
| 670 | inline int CountIf(const Container& c, Predicate predicate) { |
| 671 | // Implemented as an explicit loop since std::count_if() in libCstd on |
| 672 | // Solaris has a non-standard signature. |
| 673 | int count = 0; |
| 674 | for (typename Container::const_iterator it = c.begin(); it != c.end(); ++it) { |
| 675 | if (predicate(*it)) |
| 676 | ++count; |
| 677 | } |
| 678 | return count; |
| 679 | } |
| 680 | |
| 681 | // Applies a function/functor to each element in the container. |
| 682 | template <class Container, typename Functor> |
no test coverage detected