template <class InputIterator, class UnaryPredicate> typename iterator_traits<InputIterator>::difference_type count_if (InputIterator first, InputIterator last, UnaryPredicate pred);
[first,last)
中 pred 為 true 的元素數量。
|
|
[first,last)
,它包含 first 和 last 之間的所有元素,包括 first 指向的元素,但不包括 last 指向的元素。bool
的值。返回值表示該元素是否被此函式計數。[first,last)
中 pred 不返回 false
的元素數量。
|
|
myvector contains 5 odd values. |
[first,last)
中的物件將被訪問(每個物件恰好訪問一次)。