Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
5.00/5 (2 votes)
See more:
we have count() and count_if() in STL, why not just overload the count() function like adjacent_find() does? Thanks!
Posted

1 solution

The difference is that count and count_if have the same number of parameters (3) and adjacent_find has 2 parameters in the non-predicate version vs 3 in the predicate one.

Of course, that wouldn't be a problem with non-template functions, or with template concepts (voted and removed from C++ 0x), but with the current implementation of C++ function templates it is.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900