22 namespace seqan3::detail
60 template <
typename derived_t>
61 class alignment_matrix_column_major_range_base
76 class alignment_column_type :
public std::ranges::view_interface<alignment_column_type>
80 using view_type =
typename deferred_type<typename derived_t::column_data_view_type>::type;
82 static_assert(std::ranges::random_access_range<view_type>,
"Column view must support random access.");
83 static_assert(std::ranges::sized_range<view_type>,
"Column view must be a sized range.");
84 static_assert(std::ranges::view<view_type>,
"Column view must be a view.");
87 using sentinel = std::ranges::sentinel_t<view_type>;
106 using value_type =
typename deferred_type<typename derived_t::value_type>::type;
108 using reference =
typename deferred_type<typename derived_t::reference>::type;
110 using pointer = void;
112 using difference_type = std::ranges::range_difference_t<view_type>;
120 constexpr iterator_type() =
default;
121 constexpr iterator_type(iterator_type
const &) =
default;
122 constexpr iterator_type(iterator_type &&) =
default;
123 constexpr iterator_type & operator=(iterator_type
const &) =
default;
124 constexpr iterator_type & operator=(iterator_type &&) =
default;
125 ~iterator_type() =
default;
130 explicit constexpr iterator_type(alignment_column_type & host) :
134 host_ptr->me_ptr->on_column_iterator_creation(host_iter);
142 constexpr reference operator*() const noexcept
144 static_assert(std::convertible_to<decltype(host_ptr->me_ptr->make_proxy(host_iter)), reference>,
145 "The returned type of make_proxy must be convertible to the reference type.");
146 assert(host_ptr !=
nullptr);
147 return host_ptr->me_ptr->make_proxy(host_iter);
155 constexpr iterator_type & operator++() noexcept
157 assert(host_ptr !=
nullptr);
158 assert(host_ptr->me_ptr !=
nullptr);
160 host_ptr->me_ptr->before_column_iterator_increment(host_iter);
162 host_ptr->me_ptr->after_column_iterator_increment(host_iter);
167 constexpr iterator_type operator++(
int) noexcept
169 iterator_type tmp{*
this};
179 constexpr
bool operator==(sentinel
const & rhs)
const noexcept
181 return host_iter == rhs;
185 friend constexpr
bool operator==(sentinel
const & lhs, iterator_type
const & rhs) noexcept
191 constexpr
bool operator==(iterator_type
const & rhs)
const noexcept
193 return (host_ptr == rhs.host_ptr) && (host_iter == rhs.host_iter);
197 constexpr
bool operator!=(sentinel
const & rhs)
const noexcept
199 return !(*
this == rhs);
203 friend constexpr
bool operator!=(sentinel
const & lhs, iterator_type
const & rhs) noexcept
209 constexpr
bool operator!=(iterator_type
const & rhs)
const noexcept
211 return !(*
this == rhs);
217 alignment_column_type * host_ptr{
nullptr};
219 std::ranges::iterator_t<view_type> host_iter{};
226 constexpr alignment_column_type() =
default;
227 constexpr alignment_column_type(alignment_column_type
const &) =
default;
228 constexpr alignment_column_type(alignment_column_type &&) =
default;
229 constexpr alignment_column_type & operator=(alignment_column_type
const &) =
default;
230 constexpr alignment_column_type & operator=(alignment_column_type &&) =
default;
231 ~alignment_column_type() =
default;
241 constexpr alignment_column_type(derived_t & me, view_type ref) :
252 constexpr iterator_type
begin() noexcept
254 assert(me_ptr !=
nullptr);
255 return iterator_type{*
this};
259 constexpr
auto begin() const noexcept = delete;
262 constexpr sentinel end() noexcept
268 constexpr sentinel
end() const noexcept = delete;
272 constexpr
size_t size() const noexcept
281 derived_t * me_ptr{};
303 using value_type = alignment_column_type;
305 using reference = value_type;
307 using pointer = void;
309 using difference_type = std::ranges::range_difference_t<alignment_column_type>;
317 constexpr iterator_type() =
default;
318 constexpr iterator_type(iterator_type
const &) =
default;
319 constexpr iterator_type(iterator_type &&) =
default;
320 constexpr iterator_type & operator=(iterator_type
const &) =
default;
321 constexpr iterator_type & operator=(iterator_type &&) =
default;
322 ~iterator_type() =
default;
327 explicit constexpr iterator_type(derived_t & me) :
337 constexpr reference operator*() const noexcept
339 static_assert(std::convertible_to<decltype(me_ptr->initialise_column(column_index)), reference>,
340 "The returned type of initialise_column must be convertible to the reference type.");
341 return me_ptr->initialise_column(column_index);
349 constexpr iterator_type & operator++() noexcept
356 constexpr
void operator++(
int) noexcept
366 constexpr
bool operator==(std::default_sentinel_t
const &)
const noexcept
368 return column_index == me_ptr->num_cols;
372 friend constexpr
bool operator==(std::default_sentinel_t
const & lhs, iterator_type
const & rhs) noexcept
378 constexpr
bool operator!=(std::default_sentinel_t
const & rhs)
const noexcept
380 return !(*
this == rhs);
384 friend constexpr
bool operator!=(std::default_sentinel_t
const & lhs, iterator_type
const & rhs) noexcept
394 size_t column_index{};
401 constexpr alignment_matrix_column_major_range_base() =
default;
403 constexpr alignment_matrix_column_major_range_base(alignment_matrix_column_major_range_base
const &) =
default;
405 constexpr alignment_matrix_column_major_range_base(alignment_matrix_column_major_range_base &&) =
default;
407 constexpr alignment_matrix_column_major_range_base &
408 operator=(alignment_matrix_column_major_range_base
const &) =
default;
410 constexpr alignment_matrix_column_major_range_base &
411 operator=(alignment_matrix_column_major_range_base &&) =
default;
413 ~alignment_matrix_column_major_range_base() =
default;
423 SEQAN3_DOXYGEN_ONLY(
typedef value_type;)
428 SEQAN3_DOXYGEN_ONLY(
typedef column_data_view_type;)
440 SEQAN3_DOXYGEN_ONLY(value_type make_proxy(iter_t host_iter) noexcept {})
454 SEQAN3_DOXYGEN_ONLY(alignment_column_type initialise_column(
size_t column_index) {})
460 template <typename iter_t>
461 constexpr
void on_column_iterator_creation(iter_t SEQAN3_DOXYGEN_ONLY(host_iter)) noexcept
468 template <
typename iter_t>
469 constexpr
void before_column_iterator_increment(iter_t SEQAN3_DOXYGEN_ONLY(host_iter)) noexcept
476 template <
typename iter_t>
477 constexpr
void after_column_iterator_increment(iter_t SEQAN3_DOXYGEN_ONLY(host_iter)) noexcept
482 using iterator = iterator_type;
484 using sentinel = std::default_sentinel_t;
492 constexpr iterator
begin() noexcept
494 return iterator{
static_cast<derived_t &
>(*this)};
498 constexpr iterator
begin() const noexcept = delete;
501 constexpr sentinel end() noexcept
503 return std::default_sentinel;
507 constexpr sentinel
end() const noexcept = delete;
Provides various transformation traits used by the range module.
constexpr size_t size
The size of a type pack.
Definition: traits.hpp:151
auto const move
A view that turns lvalue-references into rvalue-references.
Definition: move.hpp:74
Provides C++20 additions to the <iterator> header.
SeqAn specific customisations in the standard namespace.
Adaptations of concepts from the Ranges TS.
Provides std::span from the C++20 standard library.
Provides various type traits on generic types.