SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
|
The iterator type over a seqan3::gap_decorator. More...
#include <seqan3/alignment/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 | |
basic_iterator ()=default | |
Defaulted. | |
basic_iterator (basic_iterator const &)=default | |
Defaulted. | |
basic_iterator & | operator= (basic_iterator const &)=default |
Defaulted. | |
basic_iterator (basic_iterator &&)=default | |
Defaulted. | |
basic_iterator & | operator= (basic_iterator &&)=default |
Defaulted. | |
~basic_iterator ()=default | |
Defaulted. | |
basic_iterator (gap_decorator const &host_) | |
Construct from seqan3::gap_decorator and initialising to first position. | |
basic_iterator (gap_decorator const &host_, typename gap_decorator::size_type const pos_) | |
Construct from seqan3::gap_decorator and explicit position. | |
Element access | |
reference | operator* () const |
Dereference operator returns a copy of the element currently pointed at. | |
reference | operator[] (difference_type const n) const |
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. | |
bool | operator== (basic_iterator const &lhs, basic_iterator const &rhs) noexcept |
Checks whether *this is equal to rhs . | |
bool | operator!= (basic_iterator const &lhs, basic_iterator const &rhs) noexcept |
Checks whether *this is not equal to rhs . | |
bool | operator< (basic_iterator const &lhs, basic_iterator const &rhs) noexcept |
Checks whether *this is less than rhs . | |
bool | operator> (basic_iterator const &lhs, basic_iterator const &rhs) noexcept |
Checks whether *this is greater than rhs . | |
bool | operator<= (basic_iterator const &lhs, basic_iterator const &rhs) noexcept |
Checks whether *this is less than or equal to rhs . | |
bool | operator>= (basic_iterator const &lhs, basic_iterator const &rhs) noexcept |
Checks whether *this is greater than or equal to rhs . | |
Arithmetic operators | |
basic_iterator & | operator++ () |
Increments iterator. | |
basic_iterator | operator++ (int) |
Returns an incremented iterator copy. | |
basic_iterator & | operator+= (difference_type const skip) |
Advances iterator by skip many positions. | |
basic_iterator | operator+ (difference_type const skip) const |
Returns an iterator copy advanced by skip many positions. | |
basic_iterator & | operator-- () |
Decrements iterator. | |
basic_iterator | operator-- (int) |
Returns a decremented iterator copy. | |
basic_iterator & | operator-= (difference_type const skip) |
Advances iterator by skip many positions. | |
basic_iterator | operator- (difference_type const skip) const |
Returns an iterator copy advanced by skip many positions. | |
difference_type | operator- (basic_iterator const lhs) const noexcept |
Returns the distance between two iterators. | |
basic_iterator | operator+ (difference_type const skip, basic_iterator const &it) |
Returns an iterator copy advanced by skip many positions. | |
basic_iterator | operator- (difference_type const skip, basic_iterator const &it) |
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.