17#include <seqan3/utility/simd/algorithm.hpp>
18#include <seqan3/utility/simd/concept.hpp>
20namespace seqan3::detail
26template <
typename index_type>
27 requires (std::integral<index_type> || simd_index<index_type>)
28struct column_index_type : detail::strong_type<index_type, column_index_type<index_type>>
31 using detail::strong_type<index_type, column_index_type<index_type>>::strong_type;
39template <std::
signed_
integral index_type>
40column_index_type(index_type) -> column_index_type<std::ptrdiff_t>;
43template <std::
unsigned_
integral index_type>
44column_index_type(index_type) -> column_index_type<size_t>;
47template <simd_index index_type>
48column_index_type(index_type) -> column_index_type<index_type>;
55template <
typename index_type>
56 requires (std::integral<index_type> || simd_index<index_type>)
57struct row_index_type : detail::strong_type<index_type, row_index_type<index_type>>
60 using detail::strong_type<index_type, row_index_type<index_type>>::strong_type;
68template <std::
signed_
integral index_type>
69row_index_type(index_type) -> row_index_type<std::ptrdiff_t>;
72template <std::
unsigned_
integral index_type>
73row_index_type(index_type) -> row_index_type<size_t>;
76template <simd_index index_type>
77row_index_type(index_type) -> row_index_type<index_type>;
84template <
typename index_t>
85 requires (std::integral<index_t> || simd_index<index_t>)
91 constexpr matrix_index() =
default;
92 constexpr matrix_index(matrix_index
const &) =
default;
93 constexpr matrix_index(matrix_index &&) =
default;
94 constexpr matrix_index & operator=(matrix_index
const &) =
default;
95 constexpr matrix_index & operator=(matrix_index &&) =
default;
96 ~matrix_index() =
default;
102 constexpr matrix_index(row_index_type<index_t>
const row_idx, column_index_type<index_t>
const col_idx) noexcept :
123 template <seqan3::arithmetic scalar_index_t>
124 constexpr matrix_index(row_index_type<scalar_index_t>
const row_idx,
125 column_index_type<scalar_index_t>
const col_idx)
noexcept
126 requires simd_index<index_t>
129 row{simd::fill<index_t>(
static_cast<typename simd_traits<index_t>::scalar_type
>(row_idx.get()))},
130 col{simd::fill<index_t>(
static_cast<typename simd_traits<index_t>::scalar_type
>(col_idx.get()))}
136 template <std::
integral other_index_t>
137 requires (!std::same_as<other_index_t, index_t>)
138 explicit constexpr matrix_index(matrix_index<other_index_t> other) noexcept :
139 row{
static_cast<index_t
>(other.row)},
140 col{
static_cast<index_t
>(other.col)}
145 template <std::
integral first_index_t, std::
integral second_index_t>
148 return std::pair{
static_cast<first_index_t
>(col),
static_cast<second_index_t
>(row)};
160matrix_index() -> matrix_index<std::ptrdiff_t>;
163template <std::
integral row_index_t, std::
integral col_index_t>
164 requires std::common_with<row_index_t, col_index_t>
165matrix_index(row_index_type<row_index_t>,
166 column_index_type<col_index_t>) -> matrix_index<std::common_type_t<row_index_t, col_index_t>>;
169template <simd_index index_t>
170matrix_index(row_index_type<index_t>, column_index_type<index_t>) -> matrix_index<index_t>;
175using matrix_coordinate = matrix_index<size_t>;
181template <simd_index index_t>
182using simd_matrix_coordinate = matrix_index<index_t>;
186using matrix_offset = matrix_index<std::ptrdiff_t>;
Provides basic data structure for strong types.
Provides concepts that do not have equivalents in C++20.