ranges::views::cache1_fn Struct Reference

## Synopsis of methods

constexpr view_closure< cache1_fn > | cache1 {}

## Public Member Functions

template<typename Rng >
constexpr auto | operator() (Rng &&rng) const -> cache1_view< all_t< Rng >> requires viewable_range< Rng > &&input_range< Rng > &&constructible_from< range_value_t< Rng >, range_reference_t< Rng >>
| Caches the most recent element within the view so that dereferencing the view's iterator multiple times doesn't incur any recomputation. This can be useful in adaptor pipelines that include combinations of `view::filter` and `view::transform`, for instance. More...

## Member Function Documentation

## operator()()

template<typename Rng >

constexpr auto ranges::views::cache1_fn::operator() | ( | Rng && | rng | ) | const -> cache1_view<all_t<Rng>> requires viewable_range<Rng> && input_range<Rng> && constructible_from<range_value_t<Rng>, range_reference_t<Rng>>

Caches the most recent element within the view so that dereferencing the view's iterator multiple times doesn't incur any recomputation. This can be useful in adaptor pipelines that include combinations of `view::filter` and `view::transform`, for instance.

Note
  `views::cache1` is always single-pass.