SeqAn3 3.3.0-rc.1
The Modern C++ library for sequence analysis.
 
Loading...
Searching...
No Matches
seqan3::detail::chunk_view< urng_t >::basic_input_iterator< const_range > Class Template Reference

Iterator for dividing an input range into chunks. More...

#include <seqan3/utility/views/chunk.hpp>

+ Inheritance diagram for seqan3::detail::chunk_view< urng_t >::basic_input_iterator< const_range >:

Classes

class  input_helper_iterator
 Helper iterator class to be used as iterator type in the subrange of this iterators value_type. More...
 

Public Types

Associated types
using difference_type = typename std::iter_difference_t< urng_it_t >
 Type for distances between iterators.
 
using value_type = std::ranges::subrange< helper_it_t, sentinel_t >
 Value type of this iterator.
 
using pointer = void
 The pointer type.
 
using reference = value_type
 Same as value_type.
 
using iterator_concept = std::input_iterator_tag
 Tag this class is a pure input iterator.
 
- Public Types inherited from seqan3::detail::maybe_iterator_category< maybe_const_iterator_t< const_range, urng_t > >
using iterator_category = MAYBE_PRESENT(std::iterator_traits< maybe_const_iterator_t< const_range, urng_t > >::iterator_category)
 The iterator category tag. (not always present!)
 

Public Member Functions

Constructors, destructor and assignment
constexpr basic_input_iterator ()=default
 Defaulted.
 
constexpr basic_input_iterator (basic_input_iterator const &)=default
 Defaulted.
 
constexpr basic_input_iterator (basic_input_iterator &&)=default
 Defaulted.
 
constexpr basic_input_iteratoroperator= (basic_input_iterator const &)=default
 Defaulted.
 
constexpr basic_input_iteratoroperator= (basic_input_iterator &&)=default
 Defaulted.
 
 ~basic_input_iterator ()=default
 Defaulted.
 
constexpr basic_input_iterator (basic_input_iterator<!const_range > it) noexcept
 Allow iterator on a const range to be constructible from an iterator over a non-const range.
 
constexpr basic_input_iterator (urng_it_t it_begin, sentinel_t it_end, std::ranges::range_difference_t< urng_t > const size_of_chunk)
 Construct from the start and end of the underlying range and a chunk size. /param[in] it_begin Iterator pointing to the first position of the underlying range. /param[in] it_end Sentinel pointing to the end of the underlying range. /param[in] size_of_chunk The chunk size, e.g. the length of the subrange returned by this iterator.
 

Private Types

using helper_it_t = input_helper_iterator< basic_input_iterator >
 This type will be used in the value_type of this iterator.
 
using sentinel_t = maybe_const_sentinel_t< const_range, urng_t >
 The sentinel type of the underlying range which is also the sentinel type of this iterator.
 
using urng_it_t = maybe_const_iterator_t< const_range, urng_t >
 The iterator type of the underlying range.
 

Friends

template<typename outer_it_type >
class input_helper_iterator
 

Comparison operators

constexpr bool operator== (basic_input_iterator const &lhs, sentinel_t const &rhs) noexcept
 Compare to the sentinel type (same as sentinel type of the underlying range).
 
constexpr bool operator== (basic_input_iterator const &lhs, basic_input_iterator const &rhs) noexcept
 Compare to another basic_input_iterator.
 
std::ranges::range_difference_t< urng_t > chunk_size
 The chunk size, e.g., the length of the subrange returned by this iterator.
 
std::ranges::range_difference_t< urng_t > remaining
 The remaining elements in the chunk.
 
urng_it_t urng_begin
 Points to the start of the underlying range.
 
sentinel_t urng_end
 Points to the end of the underlying range.
 
value_type current_chunk
 The current chunk stored as a subrange.
 
constexpr basic_input_iteratoroperator++ () noexcept
 Pre-increment.
 
constexpr basic_input_iterator operator++ (int) noexcept
 Post-increment.
 
constexpr value_type operator* () const noexcept
 Return the current chunk.
 

Detailed Description

template<std::ranges::input_range urng_t>
template<bool const_range>
requires std::ranges::view<urng_t>
class seqan3::detail::chunk_view< urng_t >::basic_input_iterator< const_range >

Iterator for dividing an input range into chunks.

Template Parameters
urng_tThe type of the underlying range. Must model std::ranges::view and std::input_range but not std::forward_range.

The basic_input_iterator can be used to iterate over an underlying input range in chunks. It holds the start and end iterator of the underlying range, the chunk size and the subrange of the current chunk. The current chunk is represented by a subrange on the underlying range with a std::views::take(chunk_size) applied.

Depending on the type of the iterator passed to the basic_iterator, different functionality is available:

Concept modelled by passed text iterator Available functions
std::input_iterator Comparison operators
Pre-increment (++it)
Post-increment (it++)
Indirection operator (*it)

Constructor & Destructor Documentation

◆ basic_input_iterator()

template<std::ranges::input_range urng_t>
template<bool const_range>
constexpr seqan3::detail::chunk_view< urng_t >::basic_input_iterator< const_range >::basic_input_iterator ( urng_it_t  it_begin,
sentinel_t  it_end,
std::ranges::range_difference_t< urng_t > const  size_of_chunk 
)
inlineexplicitconstexpr

Construct from the start and end of the underlying range and a chunk size. /param[in] it_begin Iterator pointing to the first position of the underlying range. /param[in] it_end Sentinel pointing to the end of the underlying range. /param[in] size_of_chunk The chunk size, e.g. the length of the subrange returned by this iterator.

Complexity

Constant.


The documentation for this class was generated from the following file: