The iterator type over a seqan3::gap_decorator. More...
#include <seqan3/range/decorator/gap_decorator.hpp>
Public Types | |
Associated types | |
using | difference_type = typename gap_decorator::difference_type |
The difference type. | |
using | value_type = typename gap_decorator::value_type |
The value type. | |
using | reference = typename gap_decorator::const_reference |
The reference type. | |
using | pointer = value_type * |
The pointer type. | |
using | iterator_category = std::bidirectional_iterator_tag |
The iterator category. | |
Public Member Functions | |
Constructors, destructor and assignment | |
constexpr | gap_decorator_iterator ()=default |
Defaulted. | |
constexpr | gap_decorator_iterator (gap_decorator_iterator const &)=default |
Defaulted. | |
constexpr gap_decorator_iterator & | operator= (gap_decorator_iterator const &)=default |
Defaulted. | |
constexpr | gap_decorator_iterator (gap_decorator_iterator &&)=default |
Defaulted. | |
constexpr gap_decorator_iterator & | operator= (gap_decorator_iterator &&)=default |
Defaulted. | |
~gap_decorator_iterator ()=default | |
Defaulted. | |
constexpr | gap_decorator_iterator (gap_decorator const &host_) noexcept |
Construct from seqan3::gap_decorator and initialising to first position. | |
constexpr | gap_decorator_iterator (gap_decorator const &host_, typename gap_decorator::size_type const pos_) noexcept |
Construct from seqan3::gap_decorator and explicit position. | |
Element access | |
constexpr reference | operator* () const noexcept |
Dereference operator returns a copy of the element currently pointed at. | |
constexpr reference | operator[] (difference_type const n) const noexcept |
Return underlying container value currently pointed at. | |
Protected Member Functions | |
void | jump (typename gap_decorator::size_type const new_pos) |
A helper function that performs the random access into the anchor set, updating all member variables. | |
Protected Attributes | |
gap_decorator::set_iterator_type | anchor_set_it {} |
A pointer to the current anchor gap node. Note that the current tuple value at position 0 is the start of the right gap that is still behind the current iterator position. | |
std::add_pointer_t< gap_decorator const > | host {nullptr} |
Pointer to the underlying container structure. | |
bool | is_at_gap {true} |
Caches whether the iterator points to a gap (true) or not (false). | |
gap_decorator::size_type | left_gap_end {0} |
Stores the position (incl. gaps) where the last (consecutive) gap that is still before the current iterator position ends. | |
gap_decorator::size_type | pos {0u} |
Stores the virtual position index for the seqan3::gap_decorator. | |
int64_t | ungapped_view_pos {0} |
Stores the physical position in the ungapped/underlying view. | |
Friends | |
Comparison operators | |
Compares iterators by virtual position. | |
constexpr friend bool | operator== (gap_decorator_iterator const &lhs, gap_decorator_iterator const &rhs) noexcept |
Checks whether *this is equal to rhs . | |
constexpr friend bool | operator!= (gap_decorator_iterator const &lhs, gap_decorator_iterator const &rhs) noexcept |
Checks whether *this is not equal to rhs . | |
constexpr friend bool | operator< (gap_decorator_iterator const &lhs, gap_decorator_iterator const &rhs) noexcept |
Checks whether *this is less than rhs . | |
constexpr friend bool | operator> (gap_decorator_iterator const &lhs, gap_decorator_iterator const &rhs) noexcept |
Checks whether *this is greater than rhs . | |
constexpr friend bool | operator<= (gap_decorator_iterator const &lhs, gap_decorator_iterator const &rhs) noexcept |
Checks whether *this is less than or equal to rhs . | |
constexpr friend bool | operator>= (gap_decorator_iterator const &lhs, gap_decorator_iterator const &rhs) noexcept |
Checks whether *this is greater than or equal to rhs . | |
Arithmetic operators | |
constexpr gap_decorator_iterator & | operator++ () noexcept |
Increments iterator. | |
constexpr gap_decorator_iterator | operator++ (int) noexcept |
Returns an incremented iterator copy. | |
constexpr gap_decorator_iterator & | operator+= (difference_type const skip) noexcept |
Advances iterator by skip many positions. | |
constexpr gap_decorator_iterator | operator+ (difference_type const skip) const noexcept |
Returns an iterator copy advanced by skip many positions. | |
constexpr gap_decorator_iterator & | operator-- () noexcept |
Decrements iterator. | |
constexpr gap_decorator_iterator | operator-- (int) noexcept |
Returns a decremented iterator copy. | |
constexpr gap_decorator_iterator & | operator-= (difference_type const skip) noexcept |
Advances iterator by skip many positions. | |
constexpr gap_decorator_iterator | operator- (difference_type const skip) const noexcept |
Returns an iterator copy advanced by skip many positions. | |
constexpr difference_type | operator- (gap_decorator_iterator const lhs) const noexcept |
Returns the distance between two iterators. | |
constexpr friend gap_decorator_iterator | operator+ (difference_type const skip, gap_decorator_iterator const &it) noexcept |
Returns an iterator copy advanced by skip many positions. | |
constexpr friend gap_decorator_iterator | operator- (difference_type const skip, gap_decorator_iterator const &it) noexcept |
Returns an iterator copy advanced by skip many positions. | |
The iterator type over a seqan3::gap_decorator.
This iterator returns values when dereferenced, not references, i.e. it does not satisfy the semantic requirements of Cpp17BidirectionalIterator. It does model the C++20 std::bidirectional_iterator. In addition, it offers all interfaces of a standard std::random_access_iterator except the iterator category which is defined as std::bidirectional_iterator_tag, because the complexity of the iterator is logarithmic and not constant. However, all interfaces inside the seqan3::gap_decorator make use of the more efficient logarithmic implementation. Be aware, that if you want to use the seqan3::gap_decorator in a generic algorithm, e.g. std::ranges::distance, the slower linear version will be picked due to the constraints of the iterator category. To achieve optimal performance in a generic context you can use seqan3::views::enforce_random_access to get a range over seqan3::gap_decorator which models std::random_access_iterator albeit its non-conforming runtime complexity.