I thought about that but it takes function as third argument...
And due to function call time may increase..
It's best to run Benchmarks. In this example, time did *not* increase.
http://quick-bench.com/j_QMwY3SqjjGlZvAGE3_vApkYfY
When enabling optimization the functor might be inlined, so no function call occurs
https://godbolt.org/g/6uuMBE
I think using count_if would be a good use. Since C++17 you can pass an execution policy and 'counting' might be processed in parallel
olli
Anshu
Jasmin
Dima