A BidirectionalIterator is an Iterator that can be moved both forward and backward. More...
#include <BidirectionalIterator.h>
Classes | |
| class | IRep |
| An Iterator<T> that also supports going backwards. More... | |
Public Types | |
| using | iterator_category = bidirectional_iterator_tag |
Public Types inherited from Stroika::Foundation::Traversal::Iterator< T, ITERATOR_TRAITS > | |
| using | difference_type = typename ITERATOR_TRAITS::difference_type |
| difference_type = typename ITERATOR_TRAITS::difference_type; | |
| using | value_type = typename ITERATOR_TRAITS::value_type |
| value_type = typename ITERATOR_TRAITS::value_type; | |
| using | pointer = typename ITERATOR_TRAITS::pointer |
| pointer = typename ITERATOR_TRAITS::pointer; | |
| using | reference = typename ITERATOR_TRAITS::reference |
| reference = typename ITERATOR_TRAITS::reference; | |
| using | iterator_category = forward_iterator_tag |
| iterator_category = forward_iterator_tag; | |
Public Member Functions | |
| BidirectionalIterator (const unique_ptr< IRep > &rep) noexcept | |
| This overload is usually not called directly. Instead, iterators are usually created from a container (eg. Sequence<T>{}.begin()). | |
| nonvirtual BidirectionalIterator & | operator= (BidirectionalIterator &&rhs) noexcept=default |
| Iterators are safely copyable, preserving their current position. | |
| nonvirtual BidirectionalIterator & | operator++ () |
| same as Iterator::operator++ () - advances iterator - but returns the subclass iterator type. | |
| nonvirtual BidirectionalIterator & | operator-- () |
| nonvirtual BidirectionalIterator | operator- (ptrdiff_t i) const |
| Move the iterator back by the specified number of positions. | |
| nonvirtual IRep & | GetRep () |
| Get a reference to the IRep owned by the iterator. This is an implementation detail, mainly intended for implementors. | |
| nonvirtual const IRep & | ConstGetRep () const |
| Get a reference to the IRep owned by the iterator. This is an implementation detail, mainly intended for implementors. | |
Public Member Functions inherited from Stroika::Foundation::Traversal::Iterator< T, ITERATOR_TRAITS > | |
| Iterator (const unique_ptr< IRep > &rep) noexcept | |
| This overload is usually not called directly. Instead, iterators are usually created from a container (eg. Sequence<T>{}.begin()). | |
| nonvirtual Iterator & | operator= (Iterator &&rhs) noexcept |
| Iterators are safely copyable, preserving their current position. Copy-Assigning could throw since it probably involves a Clone() | |
| nonvirtual const T & | operator* () const |
| Return the Current value pointed to by the Iterator<T> (same as Current()) | |
| nonvirtual const value_type * | operator-> () const |
| Return a pointer to the current value pointed to by the Iterator<T> (like Current()) | |
| nonvirtual Iterator & | operator++ () |
| Advance iterator; support for range-based-for, and STL style iteration in general (containers must also support begin, end). | |
| nonvirtual Iterator | operator+ (ptrdiff_t i) const |
| nonvirtual | operator bool () const |
| return not AtEnd () | |
| nonvirtual bool | operator== (const Iterator &rhs) const |
| Equals () checks if two iterators are equal to one another (point to the same position in the sequence). | |
| nonvirtual const T & | Current () const |
| Returns the value of the current item visited by the Iterator<T>, and is illegal to call if AtEnd() | |
| nonvirtual bool | AtEnd () const |
| AtEnd () means there is nothing left in this iterator (a synonym for (it == container.end ()). | |
| nonvirtual void | reset () |
| Set to AtEnd and disassociate with owner. | |
| nonvirtual void | clear () |
| Set to AtEnd and disassociate with owner. | |
| nonvirtual IRep & | GetRep () |
| Get a reference to the IRep owned by the iterator. This is an implementation detail, mainly intended for implementors. | |
| nonvirtual const IRep & | ConstGetRep () const |
| Get a reference to the IRep owned by the iterator. This is an implementation detail, mainly intended for implementors. | |
| nonvirtual void | Refresh () |
| Refresh the current iterator state based on what is in the underlying IRep. | |
| nonvirtual void | Invariant () const noexcept |
| Invariant does nothing if !qStroika_Foundation_Debug_AssertionsChecked, but if qStroika_Foundation_Debug_AssertionsChecked, checks internal state and asserts in good shape. | |
Additional Inherited Members | |
Static Public Member Functions inherited from Stroika::Foundation::Traversal::Iterator< T, ITERATOR_TRAITS > | |
| static constexpr default_sentinel_t | GetEmptyIterator () noexcept |
| Used by someContainer::end () | |
A BidirectionalIterator is an Iterator that can be moved both forward and backward.
BidirectionalIterator allows backing up (if not AtStart), and then moving forward again (if not AtEnd - like the base class Iterator).
Definition at line 34 of file BidirectionalIterator.h.
| using Stroika::Foundation::Traversal::BidirectionalIterator< T, ITERATOR_TRAITS >::iterator_category = bidirectional_iterator_tag |
Definition at line 54 of file BidirectionalIterator.h.
|
noexcept |
This overload is usually not called directly. Instead, iterators are usually created from a container (eg. Sequence<T>{}.begin()).
Iterators are safely copyable, preserving their current position.
CTOR overload taking nullptr - is the same as GetEmptyIterator ()
Definition at line 14 of file BidirectionalIterator.inl.
| auto Stroika::Foundation::Traversal::BidirectionalIterator< T, ITERATOR_TRAITS >::operator++ | ( | ) |
same as Iterator::operator++ () - advances iterator - but returns the subclass iterator type.
The subclass impl is functionaly identical, but hiding the base class implementation needed to satisfy the concepts for bidirectional iterators.
Definition at line 44 of file BidirectionalIterator.inl.
| auto Stroika::Foundation::Traversal::BidirectionalIterator< T, ITERATOR_TRAITS >::operator-- | ( | ) |
Definition at line 57 of file BidirectionalIterator.inl.
| auto Stroika::Foundation::Traversal::BidirectionalIterator< T, ITERATOR_TRAITS >::operator- | ( | ptrdiff_t | i | ) | const |
Move the iterator back by the specified number of positions.
Definition at line 71 of file BidirectionalIterator.inl.
| BidirectionalIterator< T, ITERATOR_TRAITS >::IRep & Stroika::Foundation::Traversal::BidirectionalIterator< T, ITERATOR_TRAITS >::GetRep | ( | ) |
Get a reference to the IRep owned by the iterator. This is an implementation detail, mainly intended for implementors.
Get a reference to the IRep owned by the iterator. This is an implementation detail, mainly intended for implementors.
Definition at line 81 of file BidirectionalIterator.inl.
| const BidirectionalIterator< T, ITERATOR_TRAITS >::IRep & Stroika::Foundation::Traversal::BidirectionalIterator< T, ITERATOR_TRAITS >::ConstGetRep | ( | ) | const |
Get a reference to the IRep owned by the iterator. This is an implementation detail, mainly intended for implementors.
Get a reference to the IRep owned by the iterator. This is an implementation detail, mainly intended for implementors.
Definition at line 86 of file BidirectionalIterator.inl.