4namespace Stroika::Foundation::Traversal {
11 template <
typename T,
typename ITERATOR_TRAITS>
16 template <
typename T,
typename ITERATOR_TRAITS>
17 inline RandomAccessIterator<T, ITERATOR_TRAITS>::RandomAccessIterator (unique_ptr<IRep>&& rep) noexcept
18 : inherited{move (rep)}
21 template <
typename T,
typename ITERATOR_TRAITS>
22 constexpr RandomAccessIterator<T, ITERATOR_TRAITS>::RandomAccessIterator (
const default_sentinel_t&) noexcept
23 : inherited{default_sentinel}
26 template <
typename T,
typename ITERATOR_TRAITS>
27 constexpr RandomAccessIterator<T, ITERATOR_TRAITS>::RandomAccessIterator (nullptr_t) noexcept
31 template <
typename T,
typename ITERATOR_TRAITS>
32 constexpr RandomAccessIterator<T, ITERATOR_TRAITS>::RandomAccessIterator () noexcept
36 template <
typename T,
typename ITERATOR_TRAITS>
39 GetRep ().Advance (i);
42 template <
typename T,
typename ITERATOR_TRAITS>
50 return -rhs.Difference (*
this);
55 return ConstGetRep ().Difference (
nullptr);
58 return ConstGetRep ().Difference (&rhs.ConstGetRep ());
62 template <
typename T,
typename ITERATOR_TRAITS>
65 inherited::operator++ ();
68 template <
typename T,
typename ITERATOR_TRAITS>
72 inherited::operator++ ();
75 template <
typename T,
typename ITERATOR_TRAITS>
78 inherited::operator-- ();
81 template <
typename T,
typename ITERATOR_TRAITS>
85 inherited::operator-- ();
88 template <
typename T,
typename ITERATOR_TRAITS>
95 template <
typename T,
typename ITERATOR_TRAITS>
102 template <
typename T,
typename ITERATOR_TRAITS>
108 template <
typename T,
typename ITERATOR_TRAITS>
114 template <
typename T,
typename ITERATOR_TRAITS>
117 return *ConstGetRep ().PeekAtElement (i);
119 template <
typename T,
typename ITERATOR_TRAITS>
123 return Difference (rhs) <=> 0;
125 template <
typename T,
typename ITERATOR_TRAITS>
128 return Debug::UncheckedDynamicCast<IRep&> (inherited::GetRep ());
130 template <
typename T,
typename ITERATOR_TRAITS>
133 return Debug::UncheckedDynamicCast<const IRep&> (inherited::ConstGetRep ());
136 template <
typename T,
typename ITERATOR_TRAITS>
142 template <
typename T,
typename ITERATOR_TRAITS>
143 inline typename RandomAccessIterator<T, ITERATOR_TRAITS>::difference_type operator- (
const RandomAccessIterator<T, ITERATOR_TRAITS>& lhs,
144 const RandomAccessIterator<T, ITERATOR_TRAITS>& rhs)
A BidirectionalIterator is an Iterator that can be moved both forward and backward.
The interface for the internal representation of a RandomAccessIterator.
nonvirtual const T & operator[](difference_type i) const
Access the element at the specified index (relative to the current position).
nonvirtual RandomAccessIterator & operator-=(difference_type i)
Advance (backward) this iterator by the specified number of positions (result MUST be in range)
nonvirtual IRep & GetRep()
Get a reference to the IRep owned by the iterator. This is an implementation detail,...
nonvirtual RandomAccessIterator & operator--()
nonvirtual const IRep & ConstGetRep() const
Get a reference to the IRep owned by the iterator. This is an implementation detail,...
nonvirtual difference_type Difference(const RandomAccessIterator &rhs) const
Calculate the difference between this iterator and another.
nonvirtual void Advance(difference_type i)
Advance the iterator by the specified number of positions (which may be negative)....
friend RandomAccessIterator< T2, ITERATOR_TRAITS2 > operator+(typename RandomAccessIterator< T2, ITERATOR_TRAITS2 >::difference_type i, const RandomAccessIterator< T2, ITERATOR_TRAITS2 > &it)
addition of iterator and int is commutative.
nonvirtual RandomAccessIterator & operator++()
same as Iterator::operator++ () - advances iterator - but returns the subclass iterator type.
friend RandomAccessIterator< T2, ITERATOR_TRAITS2 >::difference_type operator-(const RandomAccessIterator< T2, ITERATOR_TRAITS2 > &lhs, const RandomAccessIterator< T2, ITERATOR_TRAITS2 > &rhs)
Difference of two iterators is difference_type (number of elements between them)
nonvirtual RandomAccessIterator & operator+=(difference_type i)
Advance () this iterator by the specified number of positions (which may be negative,...
nonvirtual strong_ordering operator<=>(const RandomAccessIterator &rhs) const
compare two iterators by their position in underlying container.