Class Subspace :: sus :: iter :: IteratorOverRange

template <class R, class B, class E, class ItemT>
class IteratorOverRange final
{ ... };

The iterator created from a std::range via from_range.

Methods

auto clone() const -> IteratorOverRange<R, B, E, ItemT>

sus::mem::Clone trait.

auto exact_size_hint() const -> sus::usize
requires
std::sized_sentinel_for<B, E>

sus::iter::ExactSizeIterator trait.

auto moved(UnsafeFnMarker) && -> Iterator<std::remove_cvref_t<sus::iter::IteratorOverRange::Item>> auto
requires
sus::mem::Move<Item>
!std::is_const_v<std::remove_reference_t<Item>>

Creates an iterator which moves all of its elements. If the range does not own its elements, or the elements are used afterward, this can cause use- after-move and Undefined Behaviour.

If the range owns the elements being iterated over (such as with a std::vector) then the elements can be moved out of the range. This converts the iterator from being over T& to being over values of type T.

Subspace collections can be consumed (moved-from) to make an iterator, which helps prevent use-after-move of the elements within, and avoids the need for an adaptor like moved.

Safety

The elements in the view being iterated over will be moved from, and must not be used afterward in a way that the types do not support. The range should own the elements being iterated over, and then cleared or destroyed after iteration.

auto next() -> Option<sus::iter::IteratorOverRange::Item>

sus::iter::Iterator trait.

auto next_back() -> Option<sus::iter::IteratorOverRange::Item>
requires
std::ranges::bidirectional_range<R>

sus::iter::DoubleEndedIterator trait.

auto size_hint() const -> SizeHint

sus::iter::Iterator trait.

Operators

auto operator=(IteratorOverRange<R, B, E, ItemT>&&) -> IteratorOverRange<R, B, E, ItemT>&