4.4 KiB
[range.cache.latest.view]
25 Ranges library [ranges]
25.7 Range adaptors [range.adaptors]
25.7.34 Cache latest view [range.cache.latest]
25.7.34.2 Class template cache_latest_view [range.cache.latest.view]
namespace std::ranges {template<input_range V>requires viewclass cache_latest_view : public view_interface<cache_latest_view> { V base_ = V(); // exposition onlyusing cache-t = conditional_t<is_reference_v<range_reference_t>, // exposition only add_pointer_t<range_reference_t>, range_reference_t>; non-propagating-cache<cache-t> cache_; // exposition only// [range.cache.latest.iterator], class cache_latest_view::iteratorclass iterator; // exposition only// [range.cache.latest.sentinel], class cache_latest_view::sentinelclass sentinel; // exposition onlypublic: cache_latest_view() requires default_initializable = default; constexpr explicit cache_latest_view(V base); constexpr V base() const & requires copy_constructible { return base_; }constexpr V base() && { return std::move(base_); }constexpr auto begin(); constexpr auto end(); constexpr auto size() requires sized_range; constexpr auto size() const requires sized_range; constexpr auto reserve_hint() requires approximately_sized_range; constexpr auto reserve_hint() const requires approximately_sized_range; }; template cache_latest_view(R&&) -> cache_latest_view<views::all_t>;}
constexpr explicit cache_latest_view(V base);
Effects: Initializes base_ with std::move(base).
constexpr auto begin();
Effects: Equivalent to: return iterator(*this);
constexpr auto end();
Effects: Equivalent to: return sentinel(*this);
constexpr auto size() requires [sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<V>; constexpr auto size() const requires [sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<const V>;
Effects: Equivalent to: return ranges::size(base_);
constexpr auto reserve_hint() requires [approximately_sized_range](range.approximately.sized#concept:approximately_sized_range "25.4.3 Approximately sized ranges [range.approximately.sized]")<V>; constexpr auto reserve_hint() const requires [approximately_sized_range](range.approximately.sized#concept:approximately_sized_range "25.4.3 Approximately sized ranges [range.approximately.sized]")<const V>;
Effects: Equivalent to: return ranges::reserve_hint(base_);