21template <
typename Element>
24template <
typename Element>
81 iterator.n_ += increment;
89 iterator.n_ += increment;
96 assert(
view_ == other.view_);
104 iterator.n_ -= decrement;
123template <
typename Element>
134 return {
size(),
this};
137 [[nodiscard]]
virtual std::size_t
size() const noexcept = 0;
139 [[nodiscard]] virtual Element& operator[](std::
size_t) const = 0;
144template <typename Element, typename Container>
149 : container_{container}
155 if constexpr (
requires {
156 typename Container::value_type::element_type;
160 std::derived_from<
typename Container::value_type::element_type,
163 return *container_[index];
168 std::derived_from<typename Container::value_type, Element>);
173 (!std::is_const_v<Container>) || std::is_const_v<Element>,
174 "If the element type is non-const, the container must be "
177 return container_[index];
181 std::size_t
size() const noexcept
override {
return container_.size(); }
217template <
typename Element>
225 template <
typename Container>
229 : impl_{std::make_unique<
235 template <
typename Container>
239 : impl_{std::make_unique<
254 return impl_->begin();
262 [[nodiscard]] std::size_t
size() const noexcept {
return impl_->size(); }
detail::PolymorphicRandomAccessContainerViewIterator< Element > end() const noexcept
detail::PolymorphicRandomAccessContainerViewIterator< Element > begin() const noexcept
PolymorphicRandomAccessContainerView(PolymorphicRandomAccessContainerView const &)=delete
std::size_t size() const noexcept
Element & operator[](std::size_t n) const
PolymorphicRandomAccessContainerView(PolymorphicRandomAccessContainerView &&)=default
PolymorphicRandomAccessContainerView & operator=(PolymorphicRandomAccessContainerView &&)=default
std::unique_ptr< detail::PolymorphicRandomAccessContainerViewInterface< Element > > impl_
PolymorphicRandomAccessContainerView & operator=(PolymorphicRandomAccessContainerView const &)=delete
CovariantRandomAccessContainerView(Container &container)
Element & operator[](std::size_t index) const override
std::size_t size() const noexcept override
PolymorphicRandomAccessContainerViewIterator< Element > end() const noexcept
virtual std::size_t size() const noexcept=0
PolymorphicRandomAccessContainerViewIterator< Element > begin() const noexcept
PolymorphicRandomAccessContainerViewIterator & operator+=(difference_type const increment) noexcept
friend PolymorphicRandomAccessContainerViewIterator operator+(PolymorphicRandomAccessContainerViewIterator iterator, difference_type const increment) noexcept
PolymorphicRandomAccessContainerViewIterator(std::size_t n, PolymorphicRandomAccessContainerViewInterface< Element > const *const view) noexcept
friend PolymorphicRandomAccessContainerViewIterator operator-(PolymorphicRandomAccessContainerViewIterator iterator, difference_type const decrement) noexcept
PolymorphicRandomAccessContainerViewIterator & operator++() noexcept
Element & operator[](difference_type n) const
difference_type operator-(PolymorphicRandomAccessContainerViewIterator const other) const noexcept
PolymorphicRandomAccessContainerViewIterator()=default
PolymorphicRandomAccessContainerViewInterface< Element > const * view_
PolymorphicRandomAccessContainerViewIterator operator++(int) noexcept
auto operator<=>(PolymorphicRandomAccessContainerViewIterator const &) const =default
std::ptrdiff_t difference_type
PolymorphicRandomAccessContainerViewIterator operator--(int) noexcept
PolymorphicRandomAccessContainerViewIterator & operator-=(difference_type const decrement) noexcept
friend PolymorphicRandomAccessContainerViewIterator operator+(difference_type const increment, PolymorphicRandomAccessContainerViewIterator iterator) noexcept
Element & operator*() const
PolymorphicRandomAccessContainerViewIterator & operator--() noexcept