C++ Language/Std/Stl/Algorithms/Querying/Counting

A sorted collection has a built-in  member function that is most efficient. But for a sequence collection, you need to use the  algorithm.

Additional information about counting algorithms (includes interactive examples)