MCPcopy Create free account
hub / github.com/HelenOS/helenos / count_if

Function count_if

uspace/lib/cpp/include/__bits/algorithm.hpp:204–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

202
203 template<class InputIterator, class Predicate>
204 typename iterator_traits<InputIterator>::difference_type
205 count_if(InputIterator first, InputIterator last, Predicate pred)
206 {
207 typename iterator_traits<InputIterator>::difference_type cnt{};
208
209 while (first != last)
210 {
211 if (pred(*first++))
212 ++cnt;
213 }
214
215 return cnt;
216 }
217
218 /**
219 * 25.2.10, mismatch:

Callers 1

test_non_modifyingMethod · 0.85

Calls

no outgoing calls

Tested by 1

test_non_modifyingMethod · 0.68