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)(
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)(
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>
The indirectly_unary_invocable concept.
The sentinel_for concept.
decltype(begin(declval(Rng &))) iterator_t
Definition access.hpp:698
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
Definition adjacent_find.hpp:67
Definition identity.hpp:25