13 #ifndef RANGES_V3_ALGORITHM_FOR_EACH_HPP
14 #define RANGES_V3_ALGORITHM_FOR_EACH_HPP
20 #include <range/v3/algorithm/result_types.hpp>
29 #include <range/v3/utility/static_const.hpp>
31 #include <range/v3/detail/prologue.hpp>
37 template<
typename I,
typename F>
38 using for_each_result = detail::in_fun_result<I, F>;
40 RANGES_FUNC_BEGIN(for_each)
43 template(
typename I,
typename S,
typename F,
typename P = identity)(
44 requires input_iterator<I> AND sentinel_for<S, I> AND
46 constexpr for_each_result<I, F> RANGES_FUNC(for_each)(I
first, S last, F fun, P proj = P{})
52 return {detail::move(
first), detail::move(fun)};
56 template(
typename Rng,
typename F,
typename P = identity)(
57 requires input_range<Rng> AND
59 constexpr for_each_result<borrowed_iterator_t<Rng>, F>
60 RANGES_FUNC(for_each)(Rng && rng, F fun, P proj = P{})
62 return {(*this)(begin(rng), end(rng), ref(fun), detail::move(proj)).
in,
66 RANGES_FUNC_END(for_each)
70 using ranges::for_each;
71 using ranges::for_each_result;
76 #include <range/v3/detail/epilogue.hpp>
CPP_concept indirectly_unary_invocable
\concept indirectly_unary_invocable
Definition: concepts.hpp:545
typename Fn::template invoke< Args... > invoke
Evaluate the invocable Fn with the arguments Args.
Definition: meta.hpp:541
front< Pair > first
Retrieve the first element of the pair Pair.
Definition: meta.hpp:2251
not_< empty< find< L, T > >> in
A Boolean integral constant wrapper around true if there is at least one occurrence of T in L.
Definition: meta.hpp:3081