函数原型：
```
template <class InputIterator, class T>
  typename iterator_traits<InputIterator>::difference_type
    count (InputIterator first, InputIterator last, const T& val)
{
  typename iterator_traits<InputIterator>::difference_type ret = 0;
  while (first!=last) {
    if (*first == val) ++ret;
    ++first;
  }
  return ret;
}
```
功能： 返回序列中等于给定值元素的个数；

示例:

```
#include <iostream>  
#include <vector>  
#include <algorithm>  

int main() {  
    std::vector<int> numbers = {1, 2, 3, 2, 4, 2, 5};  

    int countOfTwos = std::count(numbers.begin(), numbers.end(), 2);  
    std::cout << "数字 2 出现的次数: " << countOfTwos << std::endl;  

    return 0;  
}
```