14#ifndef RANGES_V3_VIEW_FOR_EACH_HPP
15#define RANGES_V3_VIEW_FOR_EACH_HPP
25#include <range/v3/utility/static_const.hpp>
34#include <range/v3/detail/prologue.hpp>
48 template(
typename Rng,
typename Fun)(
51 constexpr auto operator()(Rng && rng, Fun fun)
const
53 return join(transform(
static_cast<Rng &&
>(rng), std::move(fun)));
59 using for_each_base_fn::operator();
61 template<
typename Fun>
62 constexpr auto operator()(Fun fun)
const
75 requires copy_constructible<V>)
78 return views::single(std::move(v));
83 RANGES_INLINE_VARIABLE(
yield_fn, yield)
87 template(
typename Rng)(
89 Rng operator()(Rng rng)
const
103 return views::repeat_n(std::move(v), b ? 1 : 0);
112 template(
typename F)(
116 return views::generate_n(std::move(f), b ? 1 : 0);
125 template(
typename Rng,
typename Fun)(
127 input_range<invoke_result_t<Fun &, range_reference_t<Rng>>>)
129 operator>>=(Rng && rng, Fun fun)
131 return views::for_each(
static_cast<Rng &&
>(rng), std::move(fun));
136#include <range/v3/detail/epilogue.hpp>
The viewable_range concept.
Definition generate_n.hpp:41
Definition for_each.hpp:111
Definition repeat_n.hpp:43
Lazily applies an unary function to each element in the source range that returns another range (poss...
Definition for_each.hpp:47
Definition for_each.hpp:58
Definition for_each.hpp:73
Definition for_each.hpp:86
Definition for_each.hpp:99