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
45 indirectly_unary_invocable<F, projected<I, P>>)
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
58 indirectly_unary_invocable<F, projected<iterator_t<Rng>, P>>)
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>
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