15 #include <type_traits>
21 namespace seqan3::detail
27 template <std::
integral index_type>
28 struct 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;
38 template <std::
signed_
integral index_type>
40 column_index_type(index_type) -> column_index_type<std::ptrdiff_t>;
43 template <std::
unsigned_
integral index_type>
44 column_index_type(index_type) -> column_index_type<size_t>;
51 template <std::
integral index_type>
52 struct row_index_type : detail::strong_type<index_type, row_index_type<index_type>>
55 using detail::strong_type<index_type, row_index_type<index_type>>::strong_type;
62 template <std::
signed_
integral index_type>
64 row_index_type(index_type) -> row_index_type<std::ptrdiff_t>;
67 template <std::
unsigned_
integral index_type>
68 row_index_type(index_type) -> row_index_type<size_t>;
73 template <std::
integral index_t>
79 constexpr matrix_index() =
default;
80 constexpr matrix_index(matrix_index
const &) =
default;
81 constexpr matrix_index(matrix_index &&) =
default;
82 constexpr matrix_index & operator=(matrix_index
const &) =
default;
83 constexpr matrix_index & operator=(matrix_index &&) =
default;
84 ~matrix_index() =
default;
90 constexpr matrix_index(row_index_type<index_t>
const row_idx,
91 column_index_type<index_t>
const col_idx) noexcept
92 : row{row_idx.get()}, col{col_idx.get()}
98 template <std::
integral other_index_t>
102 explicit constexpr matrix_index(matrix_index<other_index_t> other) noexcept
103 : row{static_cast<index_t>(other.row)}, col{static_cast<index_t>(other.col)}
108 template <std::
integral first_index_t, std::
integral second_index_t>
111 return std::pair{static_cast<first_index_t>(col), static_cast<second_index_t>(row)};
122 matrix_index() -> matrix_index<std::ptrdiff_t>;
126 template <std::
integral row_index_t, std::
integral col_index_t>
130 matrix_index(row_index_type<row_index_t>, column_index_type<col_index_t>) ->
131 matrix_index<std::common_type_t<row_index_t, col_index_t>>;
137 using matrix_coordinate = matrix_index<size_t>;
141 using matrix_offset = matrix_index<std::ptrdiff_t>;