44 template <detail::config_element ... configs_t>
48 template <detail::config_element ... _configs_t>
72 template <
typename config_element_t>
75 detail::config_element<std::remove_cvref_t<config_element_t>>
78 base_type{
std::forward<config_element_t>(config_element)}
87 constexpr
size_t size() const noexcept
89 return std::tuple_size_v<base_type>;
122 template <
typename alternative_t>
123 constexpr decltype(
auto)
get_or(alternative_t && alternative) & noexcept
125 return get_or_impl(*
this, alternative, std::forward<alternative_t>(alternative));
129 template <
typename alternative_t>
130 constexpr decltype(
auto)
get_or(alternative_t && alternative) const & noexcept
132 return get_or_impl(*
this, alternative, std::forward<alternative_t>(alternative));
136 template <
typename alternative_t>
137 constexpr decltype(
auto)
get_or(alternative_t && alternative) && noexcept
139 return get_or_impl(
std::move(*
this), alternative, std::forward<alternative_t>(alternative));
143 template <
typename alternative_t>
144 constexpr decltype(
auto)
get_or(alternative_t && alternative) const && noexcept
146 return get_or_impl(
std::move(*
this), alternative, std::forward<alternative_t>(alternative));
150 template <
typename query_t>
156 template <
template <
typename ...>
typename query_t>
159 return (
pack_traits::find_if<detail::is_same_configuration_f<query_t>::template invoke, configs_t...> > -1);
182 template <
typename other_configuration_t>
186 constexpr auto
append(other_configuration_t && other_config)
const
193 std::tuple{std::forward<other_configuration_t>(other_config)})
207 using other_base_same_modifier_t = detail::transfer_type_modifier_onto_t<other_configuration_t,
212 using other_configs_list_t = detail::transfer_template_args_onto_t<other_base_t, type_list>;
213 using appended_configuration_t =
215 other_configs_list_t>,
220 std::forward<other_base_same_modifier_t>(other_config))};
228 template <
typename query_t>
229 [[nodiscard]] constexpr
auto remove() const
231 #if !SEQAN3_WORKAROUND_GCC_95371
232 requires (exists<query_t>())
237 return remove_at<index>();
241 template <
template <
typename ...>
typename query_t>
242 [[nodiscard]] constexpr
auto remove() const
244 #if !SEQAN3_WORKAROUND_GCC_95371
245 requires (exists<query_t>())
249 constexpr
int index = pack_traits::find_if<detail::is_same_configuration_f<query_t>::template invoke,
251 return remove_at<index>();
261 template <
typename ..._configs_t>
266 template <
typename ..._configs_t>
281 [[nodiscard]] constexpr
auto remove_at()
const
283 static_assert((index >= 0) && (index <
sizeof...(configs_t)),
"Index to remove from config is out of bounds.");
285 auto [head, middle] = tuple_split<index>(
static_cast<base_type
>(*
this));
288 using head_list_t = detail::transfer_template_args_onto_t<decltype(head),
type_list>;
289 using tail_list_t = detail::transfer_template_args_onto_t<decltype(tail),
type_list>;
290 using concat_list_t = list_traits::concat<head_list_t, tail_list_t>;
291 using new_configuration_t = detail::transfer_template_args_onto_t<concat_list_t, configuration>;
314 template <
typename this_t,
typename query_t,
typename alternative_t>
315 static constexpr decltype(
auto) get_or_impl(this_t && me,
316 query_t const & SEQAN3_DOXYGEN_ONLY(query),
317 alternative_t && alternative) noexcept
319 if constexpr (exists<query_t>())
321 return get<query_t>(std::forward<this_t>(me));
326 return static_cast<ret_type
>(alternative);
331 template <
typename this_t,
332 template <
typename ...>
typename query_template_t,
typename ...parameters_t,
333 typename alternative_t>
334 static constexpr decltype(
auto) get_or_impl(this_t && me,
335 query_template_t<parameters_t...> const &,
336 alternative_t && alternative) noexcept
338 if constexpr (exists<query_template_t>())
340 return get<query_template_t>(std::forward<this_t>(me));
345 return static_cast<ret_type
>(alternative);
357 template <detail::config_element config_t>
380 template <
typename lhs_config_t,
typename rhs_config_t>
384 constexpr auto operator|(lhs_config_t && lhs, rhs_config_t && rhs)
387 return configuration{std::forward<lhs_config_t>(lhs)}.
append(std::forward<rhs_config_t>(rhs));
389 return std::forward<lhs_config_t>(lhs).append(std::forward<rhs_config_t>(rhs));
423 template <
template <
typename ...>
class query_t,
typename ...configs_t>
426 constexpr
auto pos = pack_traits::find_if<detail::is_same_configuration_f<query_t>::template invoke, configs_t...>;
427 static_assert(pos > -1,
"Access error: The requested type is not contained.");
429 return get<pos>(config);
433 template <
template <
typename ...>
class query_t,
typename ...configs_t>
436 constexpr
auto pos = pack_traits::find_if<detail::is_same_configuration_f<query_t>::template invoke, configs_t...>;
437 static_assert(pos > -1,
"Access error: The requested type is not contained.");
439 return get<pos>(config);
443 template <
template <
typename ...>
class query_t,
typename ...configs_t>
446 constexpr
auto pos = pack_traits::find_if<detail::is_same_configuration_f<query_t>::template invoke, configs_t...>;
447 static_assert(pos > -1,
"Access error: The requested type is not contained.");
453 template <
template <
typename ...>
class query_t,
typename ...configs_t>
456 constexpr
auto pos = pack_traits::find_if<detail::is_same_configuration_f<query_t>::template invoke, configs_t...>;
457 static_assert(pos > -1,
"Access error: The requested type is not contained.");
476 template <seqan3::detail::config_element ... configs_t>
477 struct tuple_size<
seqan3::configuration<configs_t...>>
488 template <
size_t pos, seqan3::detail::config_element ... configs_t>
489 struct tuple_element<pos,
seqan3::configuration<configs_t...>>
Collection of elements to configure an algorithm.
Definition: configuration.hpp:46
constexpr auto append(other_configuration_t &&other_config) const
Returns a new configuration by appending the given configuration to the current one.
Definition: configuration.hpp:186
constexpr size_t size() const noexcept
Returns the number of contained config elements.
Definition: configuration.hpp:87
constexpr auto remove() const
Remove a config element from the configuration.
Definition: configuration.hpp:229
configuration(config_t) -> configuration< config_t >
Deduces the correct configuration element type from the passed seqan3::pipeable_config_element.
constexpr configuration(configuration &&)=default
Defaulted.
constexpr configuration & operator=(configuration const &)=default
Defaulted.
constexpr decltype(auto) get_or(alternative_t &&alternative) &noexcept
Returns the stored configuration element if present otherwise the given alternative.
Definition: configuration.hpp:123
~configuration()=default
Defaulted.
constexpr configuration(config_element_t &&config_element)
Constructs a configuration from a single configuration element.
Definition: configuration.hpp:77
constexpr configuration & operator=(configuration &&)=default
Defaulted.
constexpr configuration(configuration const &)=default
Defaulted.
constexpr configuration()=default
Defaulted.
static constexpr bool exists() noexcept
Checks if the given type exists in the tuple.
Definition: configuration.hpp:151
Provides various auxiliary functions with which parts of the configurations can be checked.
Provides concepts for the configuration classes.
constexpr bool is_config_element_combineable_v
Helper variable template to test if a configuration element is combineable with another configuration...
Definition: concept.hpp:214
constexpr auto & get(configuration< configs_t... > &config) noexcept
Returns the stored element.
Definition: configuration.hpp:424
meta::list< types... > type_list
Type that contains multiple types, an alias for meta::list.
Definition: type_list.hpp:31
decltype(detail::concat(lists_t{}...)) concat
Join two seqan3::type_list s into one.
Definition: traits.hpp:292
constexpr ptrdiff_t find
Get the index of the first occurrence of a type in a pack.
Definition: traits.hpp:186
constexpr ptrdiff_t find_if
Get the index of the first type in a pack that satisfies the given predicate.
Definition: traits.hpp:209
constexpr bool contains
Whether a type occurs in a pack or not.
Definition: traits.hpp:227
typename remove_rvalue_reference< t >::type remove_rvalue_reference_t
Return the input type with && removed, but lvalue references preserved (transformation_trait shortcut...
Definition: basic.hpp:68
constexpr auto tuple_pop_front(tuple_t &&t)
Removes the first element of a tuple.
Definition: tuple_utility.hpp:180
auto const move
A view that turns lvalue-references into rvalue-references.
Definition: move.hpp:70
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
SeqAn specific customisations in the standard namespace.
Provides seqan3::pipeable_config_element.
Provides type traits seqan3::detail::transfer_type_modifier_onto.
Provides utility functions for tuple like interfaces.
Provides seqan3::type_list.
Provides various traits for template packs.