13#ifndef RANGES_V3_ALGORITHM_COUNT_IF_HPP
14#define RANGES_V3_ALGORITHM_COUNT_IF_HPP
27#include <range/v3/utility/static_const.hpp>
29#include <range/v3/detail/prologue.hpp>
35 RANGES_FUNC_BEGIN(count_if)
38 template(typename I, typename S, typename R, typename P =
identity)(
41 constexpr iter_difference_t<I> RANGES_FUNC(count_if)(I first, S last, R pred, P proj = P{})
43 iter_difference_t<I> n = 0;
44 for(; first != last; ++first)
45 if(invoke(pred, invoke(proj, *first)))
51 template(
typename Rng,
typename R,
typename P =
identity)(
54 constexpr iter_difference_t<iterator_t<Rng>>
55 RANGES_FUNC(count_if)(Rng && rng, R pred, P proj = P{})
57 return (*
this)(begin(rng), end(rng), std::move(pred), std::move(proj));
60 RANGES_FUNC_END(count_if)
64 using ranges::count_if;
69#include <range/v3/detail/epilogue.hpp>
The indirect_unary_predicate concept.
The sentinel_for concept.
decltype(begin(declval(Rng &))) iterator_t
Definition access.hpp:698
Definition identity.hpp:25