C++ Algorithm Function count_if ()
C++ Algorithm count_if() function has a 'pred' value and returns the count of the elements in the range [first,last) for which the value of pred is true.
first: It is an input iterator to the first element in the range.
last: It is an input iterator to the last element in the range.
val: It is the element whose occurrence is being searched in the range.
The function returns the number of element in the range [first,last) for which the value of pred is true.
newvector contains 5 odd values.
Count of even number is: 10
The complexity of the function is linear up to a distance between first and last element.
Some or all of the elements of the range are accessed
The function throws an exception if any of the argument throws one.