35 struct cache1_view :
view_facade<cache1_view<Rng>, range_cardinality<Rng>::value>
40 CPP_assert(constructible_from<range_value_t<Rng>, range_reference_t<Rng>>);
44 detail::non_propagating_cache<range_value_t<Rng>> cache_;
47 auto update_(range_reference_t<Rng> && val)
49 requires assignable_from<range_value_t<Rng> &, range_reference_t<Rng>>)
52 cache_.emplace(
static_cast<range_reference_t<Rng> &&
>(val));
54 *cache_ =
static_cast<range_reference_t<Rng> &&
>(val);
57 auto update_(range_reference_t<Rng> && val)
59 requires (!assignable_from<range_value_t<Rng> &, range_reference_t<Rng>>))
61 cache_.emplace(
static_cast<range_reference_t<Rng> &&
>(val));
70 sentinel_t<Rng> last_;
74 constexpr explicit sentinel(sentinel_t<Rng> last)
75 : last_(std::move(last))
82 cache1_view * parent_;
86 using value_type = range_value_t<Rng>;
87 using single_pass = std::true_type;
88 using difference_type = range_difference_t<Rng>;
92 constexpr explicit cursor(cache1_view * parent,
iterator_t<Rng> current)
94 , current_(std::move(current))
96 range_value_t<Rng> && read()
const
100 parent_->update_(*current_);
101 parent_->dirty_ =
false;
103 return std::move(*parent_->cache_);
108 parent_->dirty_ =
true;
110 bool equal(cursor
const & that)
const
112 return current_ == that.current_;
114 bool equal(sentinel
const & that)
const
116 return current_ == that.last_;
119 auto distance_to(cursor
const & that)
const
120 -> CPP_ret(difference_type)(
123 return that.current_ - current_;
126 auto distance_to(sentinel
const & that)
const
127 -> CPP_ret(difference_type)(
130 return that.last_ - current_;
134 cursor begin_cursor()
137 return cursor{
this, ranges::begin(rng_)};
140 cursor end_cursor_impl(std::true_type)
142 return cursor{
this, ranges::end(rng_)};
144 sentinel end_cursor_impl(std::false_type)
146 return sentinel{ranges::end(rng_)};
154 cache1_view() =
default;
155 constexpr explicit cache1_view(Rng rng)
156 : rng_{std::move(rng)}
159 constexpr auto CPP_fun(size)()(
162 return ranges::size(rng_);
RANGES_INLINE_VARIABLE(detail::to_container_fn< detail::from_range< std::vector > >, to_vector) template< template< typename... > class ContT > auto to(RANGES_HIDDEN_DETAIL(detail
For initializing a container of the specified type with the elements of an Range.
Definition conversion.hpp:399