20namespace seqan3::detail
58template <
typename derived_t>
59class alignment_matrix_column_major_range_base
74 class alignment_column_type :
public std::ranges::view_interface<alignment_column_type>
78 using view_type =
typename deferred_type<typename derived_t::column_data_view_type>::type;
80 static_assert(std::ranges::random_access_range<view_type>,
"Column view must support random access.");
81 static_assert(std::ranges::sized_range<view_type>,
"Column view must be a sized range.");
82 static_assert(std::ranges::view<view_type>,
"Column view must be a view.");
85 using sentinel = std::ranges::sentinel_t<view_type>;
103 using value_type =
typename deferred_type<typename derived_t::value_type>::type;
105 using reference =
typename deferred_type<typename derived_t::reference>::type;
107 using pointer = void;
109 using difference_type = std::ranges::range_difference_t<view_type>;
117 constexpr iterator_type() =
default;
118 constexpr iterator_type(iterator_type
const &) =
default;
119 constexpr iterator_type(iterator_type &&) =
default;
120 constexpr iterator_type & operator=(iterator_type
const &) =
default;
121 constexpr iterator_type & operator=(iterator_type &&) =
default;
122 ~iterator_type() =
default;
127 explicit constexpr iterator_type(alignment_column_type & host) :
131 host_ptr->me_ptr->on_column_iterator_creation(host_iter);
139 constexpr reference operator*() const noexcept
141 static_assert(std::convertible_to<
decltype(host_ptr->me_ptr->make_proxy(host_iter)), reference>,
142 "The returned type of make_proxy must be convertible to the reference type.");
143 assert(host_ptr !=
nullptr);
144 return host_ptr->me_ptr->make_proxy(host_iter);
152 constexpr iterator_type & operator++() noexcept
154 assert(host_ptr !=
nullptr);
155 assert(host_ptr->me_ptr !=
nullptr);
157 host_ptr->me_ptr->before_column_iterator_increment(host_iter);
159 host_ptr->me_ptr->after_column_iterator_increment(host_iter);
164 constexpr iterator_type operator++(
int)
noexcept
166 iterator_type tmp{*
this};
176 constexpr bool operator==(sentinel
const & rhs)
const noexcept
178 return host_iter == rhs;
182 friend constexpr bool operator==(sentinel
const & lhs, iterator_type
const & rhs)
noexcept
188 constexpr bool operator==(iterator_type
const & rhs)
const noexcept
190 return (host_ptr == rhs.host_ptr) && (host_iter == rhs.host_iter);
194 constexpr bool operator!=(sentinel
const & rhs)
const noexcept
196 return !(*
this == rhs);
200 friend constexpr bool operator!=(sentinel
const & lhs, iterator_type
const & rhs)
noexcept
206 constexpr bool operator!=(iterator_type
const & rhs)
const noexcept
208 return !(*
this == rhs);
214 alignment_column_type * host_ptr{
nullptr};
216 std::ranges::iterator_t<view_type> host_iter{};
223 constexpr alignment_column_type() =
default;
224 constexpr alignment_column_type(alignment_column_type
const &) =
default;
225 constexpr alignment_column_type(alignment_column_type &&) =
default;
226 constexpr alignment_column_type & operator=(alignment_column_type
const &) =
default;
227 constexpr alignment_column_type & operator=(alignment_column_type &&) =
default;
228 ~alignment_column_type() =
default;
238 constexpr alignment_column_type(derived_t & me, view_type ref) :
ref{
std::
move(
ref)}, me_ptr{&me}
247 constexpr iterator_type
begin() noexcept
249 assert(me_ptr !=
nullptr);
250 return iterator_type{*
this};
254 constexpr auto begin() const noexcept = delete;
257 constexpr sentinel end() noexcept
263 constexpr sentinel
end() const noexcept = delete;
267 constexpr
size_t size() const noexcept
269 return std::ranges::size(ref);
276 derived_t * me_ptr{};
298 using value_type = alignment_column_type;
300 using reference = value_type;
302 using pointer = void;
304 using difference_type = std::ranges::range_difference_t<alignment_column_type>;
312 constexpr iterator_type() =
default;
313 constexpr iterator_type(iterator_type
const &) =
default;
314 constexpr iterator_type(iterator_type &&) =
default;
315 constexpr iterator_type & operator=(iterator_type
const &) =
default;
316 constexpr iterator_type & operator=(iterator_type &&) =
default;
317 ~iterator_type() =
default;
322 explicit constexpr iterator_type(derived_t & me) : me_ptr{&me}, column_index{0}
330 constexpr reference operator*() const noexcept
332 static_assert(std::convertible_to<
decltype(me_ptr->initialise_column(column_index)), reference>,
333 "The returned type of initialise_column must be convertible to the reference type.");
334 return me_ptr->initialise_column(column_index);
342 constexpr iterator_type & operator++() noexcept
349 constexpr void operator++(
int)
noexcept
359 constexpr bool operator==(std::default_sentinel_t
const &)
const noexcept
361 return column_index == me_ptr->num_cols;
365 friend constexpr bool operator==(std::default_sentinel_t
const & lhs, iterator_type
const & rhs)
noexcept
371 constexpr bool operator!=(std::default_sentinel_t
const & rhs)
const noexcept
373 return !(*
this == rhs);
377 friend constexpr bool operator!=(std::default_sentinel_t
const & lhs, iterator_type
const & rhs)
noexcept
387 size_t column_index{};
394 constexpr alignment_matrix_column_major_range_base() =
default;
396 constexpr alignment_matrix_column_major_range_base(alignment_matrix_column_major_range_base
const &) =
default;
398 constexpr alignment_matrix_column_major_range_base(alignment_matrix_column_major_range_base &&) =
default;
400 constexpr alignment_matrix_column_major_range_base &
401 operator=(alignment_matrix_column_major_range_base
const &) =
default;
403 constexpr alignment_matrix_column_major_range_base &
404 operator=(alignment_matrix_column_major_range_base &&) =
default;
406 ~alignment_matrix_column_major_range_base() =
default;
416 SEQAN3_DOXYGEN_ONLY(
typedef value_type;)
421 SEQAN3_DOXYGEN_ONLY(
typedef column_data_view_type;)
433 SEQAN3_DOXYGEN_ONLY(value_type make_proxy(iter_t host_iter)
noexcept {})
447 SEQAN3_DOXYGEN_ONLY(alignment_column_type initialise_column(
size_t column_index){})
453 template <typename iter_t>
454 constexpr void on_column_iterator_creation(iter_t SEQAN3_DOXYGEN_ONLY(host_iter))
noexcept
461 template <
typename iter_t>
462 constexpr void before_column_iterator_increment(iter_t SEQAN3_DOXYGEN_ONLY(host_iter))
noexcept
469 template <
typename iter_t>
470 constexpr void after_column_iterator_increment(iter_t SEQAN3_DOXYGEN_ONLY(host_iter))
noexcept
475 using iterator = iterator_type;
477 using sentinel = std::default_sentinel_t;
485 constexpr iterator
begin() noexcept
487 return iterator{
static_cast<derived_t &
>(*this)};
491 constexpr iterator
begin() const noexcept = delete;
494 constexpr sentinel end() noexcept
496 return std::default_sentinel;
500 constexpr sentinel
end() const noexcept = delete;
Provides various type traits on generic types.
Provides various transformation traits used by the range module.
SeqAn specific customisations in the standard namespace.