13#ifndef RANGES_V3_ALGORITHM_COUNT_HPP
14#define RANGES_V3_ALGORITHM_COUNT_HPP
27#include <range/v3/utility/static_const.hpp>
29#include <range/v3/detail/prologue.hpp>
35 RANGES_FUNC_BEGIN(count)
38 template(typename I, typename S, typename V, typename P =
identity)(
41 constexpr iter_difference_t<I>
42 RANGES_FUNC(count)(I first, S last, V const & val, P proj = P{})
44 iter_difference_t<I> n = 0;
45 for(; first != last; ++first)
46 if(invoke(proj, *first) == val)
52 template(
typename Rng,
typename V,
typename P =
identity)(
55 constexpr iter_difference_t<iterator_t<Rng>>
56 RANGES_FUNC(count)(Rng && rng, V
const & val, P proj = P{})
58 return (*
this)(begin(rng), end(rng), val, std::move(proj));
61 RANGES_FUNC_END(count)
70#include <range/v3/detail/epilogue.hpp>
The indirect_relation concept.
The sentinel_for concept.
decltype(begin(declval(Rng &))) iterator_t
Definition access.hpp:698
Definition comparisons.hpp:28
Definition identity.hpp:25