19#include <seqan3/utility/simd/concept.hpp>
22namespace seqan3::detail
41concept tracedirections_or_simd = std::same_as<std::remove_cvref_t<t>, trace_directions> || simd_concept<t>;
56concept affine_score_cell =
tuple_like<t> && std::tuple_size_v<t> == 3
57 && arithmetic_or_simd<std::remove_reference_t<std::tuple_element_t<0, t>>>
58 && arithmetic_or_simd<std::remove_reference_t<std::tuple_element_t<1, t>>>
59 && arithmetic_or_simd<std::remove_reference_t<std::tuple_element_t<2, t>>>;
74concept affine_trace_cell =
tuple_like<t> && std::tuple_size_v<t> == 3
75 && tracedirections_or_simd<std::remove_reference_t<std::tuple_element_t<0, t>>>
76 && tracedirections_or_simd<std::remove_reference_t<std::tuple_element_t<1, t>>>
77 && tracedirections_or_simd<std::remove_reference_t<std::tuple_element_t<2, t>>>;
92concept affine_score_and_trace_cell =
94 && affine_score_cell<std::tuple_element_t<0, t>> && affine_trace_cell<std::tuple_element_t<1, t>>;
111template <
typename tuple_t>
112 requires (affine_score_cell<tuple_t> || affine_score_and_trace_cell<tuple_t>)
113class affine_cell_proxy : public tuple_t
119 using trace_cell_type =
126 affine_cell_proxy() =
default;
127 affine_cell_proxy(affine_cell_proxy
const &) =
default;
128 affine_cell_proxy(affine_cell_proxy &&) =
default;
129 affine_cell_proxy & operator=(affine_cell_proxy
const &) =
default;
130 affine_cell_proxy & operator=(affine_cell_proxy &&) =
default;
131 ~affine_cell_proxy() =
default;
134 using tuple_t::tuple_t;
137 template <
typename other_tuple_t>
138 requires std::constructible_from<tuple_t, other_tuple_t &&>
139 explicit affine_cell_proxy(other_tuple_t && other) : tuple_t{
std::
forward<other_tuple_t>(other)}
143 template <
typename other_tuple_t>
144 requires std::constructible_from<tuple_t, other_tuple_t const &>
145 explicit affine_cell_proxy(affine_cell_proxy<other_tuple_t>
const & other) :
146 tuple_t{static_cast<other_tuple_t const &>(other)}
150 template <
typename other_tuple_t>
151 requires std::constructible_from<tuple_t, other_tuple_t>
152 explicit affine_cell_proxy(affine_cell_proxy<other_tuple_t> && other) :
153 tuple_t{static_cast<other_tuple_t &&>(
std::
move(other))}
157 template <
typename other_tuple_t>
158 requires std::assignable_from<tuple_t &, other_tuple_t &&>
159 affine_cell_proxy & operator=(other_tuple_t && other)
161 as_base() = std::forward<other_tuple_t>(other);
166 template <
typename other_tuple_t>
167 requires std::assignable_from<tuple_t &, other_tuple_t const &>
168 affine_cell_proxy & operator=(affine_cell_proxy<other_tuple_t>
const & other)
170 as_base() =
static_cast<other_tuple_t
const &
>(other);
175 template <
typename other_tuple_t>
176 requires std::assignable_from<tuple_t &, other_tuple_t>
177 affine_cell_proxy & operator=(affine_cell_proxy<other_tuple_t> && other)
179 as_base() =
static_cast<other_tuple_t &&
>(std::move(other));
189 decltype(
auto) best_score() &
noexcept
191 return get_score_impl<0>(*
this);
194 decltype(
auto) best_score()
const &
noexcept
196 return get_score_impl<0>(*
this);
199 decltype(
auto) best_score() &&
noexcept
201 return get_score_impl<0>(std::move(*
this));
204 decltype(
auto) best_score()
const &&
noexcept
206 return get_score_impl<0>(std::move(*
this));
210 decltype(
auto) horizontal_score() &
noexcept
212 return get_score_impl<1>(*
this);
215 decltype(
auto) horizontal_score()
const &
noexcept
217 return get_score_impl<1>(*
this);
220 decltype(
auto) horizontal_score() &&
noexcept
222 return get_score_impl<1>(std::move(*
this));
225 decltype(
auto) horizontal_score()
const &&
noexcept
227 return get_score_impl<1>(std::move(*
this));
231 decltype(
auto) vertical_score() &
noexcept
233 return get_score_impl<2>(*
this);
236 decltype(
auto) vertical_score()
const &
noexcept
238 return get_score_impl<2>(*
this);
241 decltype(
auto) vertical_score() &&
noexcept
243 return get_score_impl<2>(std::move(*
this));
246 decltype(
auto) vertical_score()
const &&
noexcept
248 return get_score_impl<2>(std::move(*
this));
257 decltype(
auto) best_trace() &
noexcept
258 requires affine_score_and_trace_cell<tuple_t>
260 return get_trace_impl<0>(*
this);
263 decltype(
auto) best_trace()
const &
noexcept
264 requires affine_score_and_trace_cell<tuple_t>
266 return get_trace_impl<0>(*
this);
269 decltype(
auto) best_trace() &&
noexcept
270 requires affine_score_and_trace_cell<tuple_t>
272 return get_trace_impl<0>(std::move(*
this));
275 decltype(
auto) best_trace()
const &&
noexcept
276 requires affine_score_and_trace_cell<tuple_t>
278 return get_trace_impl<0>(std::move(*
this));
282 decltype(
auto) horizontal_trace() &
noexcept
283 requires affine_score_and_trace_cell<tuple_t>
285 return get_trace_impl<1>(*
this);
288 decltype(
auto) horizontal_trace()
const &
noexcept
289 requires affine_score_and_trace_cell<tuple_t>
291 return get_trace_impl<1>(*
this);
294 decltype(
auto) horizontal_trace() &&
noexcept
295 requires affine_score_and_trace_cell<tuple_t>
297 return get_trace_impl<1>(std::move(*
this));
300 decltype(
auto) horizontal_trace()
const &&
noexcept
301 requires affine_score_and_trace_cell<tuple_t>
303 return get_trace_impl<1>(std::move(*
this));
307 decltype(
auto) vertical_trace() &
noexcept
308 requires affine_score_and_trace_cell<tuple_t>
310 return get_trace_impl<2>(*
this);
313 decltype(
auto) vertical_trace()
const &
noexcept
314 requires affine_score_and_trace_cell<tuple_t>
316 return get_trace_impl<2>(*
this);
319 decltype(
auto) vertical_trace() &&
noexcept
320 requires affine_score_and_trace_cell<tuple_t>
322 return get_trace_impl<2>(std::move(*
this));
325 decltype(
auto) vertical_trace()
const &&
noexcept
326 requires affine_score_and_trace_cell<tuple_t>
328 return get_trace_impl<2>(std::move(*
this));
341 template <
size_t index,
typename this_t>
343 static constexpr decltype(
auto) get_score_impl(this_t && me)
noexcept
347 if constexpr (affine_score_cell<tuple_t>)
348 return get<index>(std::forward<this_t>(me));
350 return get<index>(get<0>(std::forward<this_t>(me)));
361 template <
size_t index,
typename this_t>
362 requires (index < 3 && affine_score_and_trace_cell<tuple_t>)
363 static constexpr decltype(
auto) get_trace_impl(this_t && me)
noexcept
367 return get<index>(get<1>(std::forward<this_t>(me)));
371 tuple_t & as_base() &
noexcept
373 return static_cast<tuple_t &
>(*this);
381template <
typename tuple_t>
382 requires (seqan3::detail::affine_score_cell<tuple_t> || seqan3::detail::affine_score_and_trace_cell<tuple_t>)
383struct tuple_size<seqan3::detail::affine_cell_proxy<tuple_t>> : public tuple_size<tuple_t>
386template <
size_t index,
typename tuple_t>
387 requires (seqan3::detail::affine_score_cell<tuple_t> || seqan3::detail::affine_score_and_trace_cell<tuple_t>)
388struct tuple_element<index, seqan3::detail::affine_cell_proxy<tuple_t>> : public tuple_element<index, tuple_t>
Provides seqan3::detail::empty_type.
A type that satisfies std::is_arithmetic_v<t>.
Whether a type behaves like a tuple.
SeqAn specific customisations in the standard namespace.
Provides the declaration of seqan3::detail::trace_directions.
Provides concepts that do not have equivalents in C++20.
Provides seqan3::tuple_like.