Count Elements

Count algorithms assist us in counting the number of elements in a range which satisfy a certain predicate.

You can count elements with the STL with and without a predicate.

Returns the number of elements:

Get hands-on with 1000+ tech skills courses.