C++ Standard Library count() Sample

Description

count() is used to count occurrences of a value in a sequence of elements.

Declaration

	template <class In, class T>
	    iterator_traits<In>::difference_type count(In, In, const T&);

Concept

The sample program sets up a string, and then counts all the a letters within it. A value of 6 is displayed.

Special Notes:

Note that the return type for the count of elements is iterator_traits<T>::difference_type, which captures varying platform-specific size requirements in a portable way.

Supported
Supported
Supported