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))
86 using value_type = range_value_t<Rng>;
87 using single_pass = std::true_type;
88 using difference_type = range_difference_t<Rng>;
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_)};
156 : rng_{std::move(rng)}
159 constexpr auto CPP_fun(size)()(
162 return ranges::size(rng_);