43template <detail::config_element ... configs_t>
47 template <detail::config_element ... _configs_t>
71 template <
typename config_element_t>
73 requires (!std::same_as<std::remove_cvref_t<config_element_t>,
configuration>) &&
77 base_type{std::forward<config_element_t>(config_element)}
86 constexpr size_t size() const noexcept
88 return std::tuple_size_v<base_type>;
121 template <
typename alternative_t>
122 constexpr decltype(
auto)
get_or(alternative_t && alternative) &
noexcept
124 return get_or_impl(*
this, alternative, std::forward<alternative_t>(alternative));
128 template <
typename alternative_t>
129 constexpr decltype(
auto)
get_or(alternative_t && alternative)
const &
noexcept
131 return get_or_impl(*
this, alternative, std::forward<alternative_t>(alternative));
135 template <
typename alternative_t>
136 constexpr decltype(
auto)
get_or(alternative_t && alternative) &&
noexcept
138 return get_or_impl(std::move(*
this), alternative, std::forward<alternative_t>(alternative));
142 template <
typename alternative_t>
143 constexpr decltype(
auto)
get_or(alternative_t && alternative)
const &&
noexcept
145 return get_or_impl(std::move(*
this), alternative, std::forward<alternative_t>(alternative));
149 template <
typename query_t>
155 template <
template <
typename ...>
typename query_t>
158 return (
pack_traits::find_if<detail::is_same_configuration_f<query_t>::template invoke, configs_t...> > -1);
181 template <
typename other_configuration_t>
183 requires (is_config_element_combineable_v<configs_t, std::remove_cvref_t<other_configuration_t>> && ...)
185 constexpr auto append(other_configuration_t && other_config)
const
187 if constexpr (detail::config_element<std::remove_cvref_t<other_configuration_t>>)
192 std::tuple{std::forward<other_configuration_t>(other_config)})
206 using other_base_same_modifier_t = detail::transfer_type_modifier_onto_t<other_configuration_t,
211 using other_configs_list_t = detail::transfer_template_args_onto_t<other_base_t, type_list>;
212 using appended_configuration_t =
214 other_configs_list_t>,
219 std::forward<other_base_same_modifier_t>(other_config))};
227 template <
typename query_t>
228 [[nodiscard]]
constexpr auto remove() const
230 requires (
exists<query_t>())
234 return remove_at<index>();
238 template <
template <
typename ...>
typename query_t>
239 [[nodiscard]]
constexpr auto remove() const
241 requires (
exists<query_t>())
244 constexpr int index = pack_traits::find_if<detail::is_same_configuration_f<query_t>::template invoke,
246 return remove_at<index>();
256 template <
typename ..._configs_t>
261 template <
typename ..._configs_t>
276 [[nodiscard]]
constexpr auto remove_at()
const
278 static_assert((index >= 0) && (index <
sizeof...(configs_t)),
"Index to remove from config is out of bounds.");
280 auto [head, middle] = tuple_split<index>(
static_cast<base_type
>(*
this));
283 using head_list_t = detail::transfer_template_args_onto_t<
decltype(head), type_list>;
284 using tail_list_t = detail::transfer_template_args_onto_t<
decltype(tail), type_list>;
285 using concat_list_t = list_traits::concat<head_list_t, tail_list_t>;
286 using new_configuration_t = detail::transfer_template_args_onto_t<concat_list_t, configuration>;
288 return new_configuration_t{
std::tuple_cat(std::move(head), std::move(tail))};
309 template <
typename this_t,
typename query_t,
typename alternative_t>
310 static constexpr decltype(
auto) get_or_impl(this_t && me,
311 query_t
const & SEQAN3_DOXYGEN_ONLY(query),
312 alternative_t && alternative)
noexcept
314 if constexpr (exists<query_t>())
316 return get<query_t>(std::forward<this_t>(me));
320 using ret_type = remove_rvalue_reference_t<
decltype(alternative)>;
321 return static_cast<ret_type
>(alternative);
326 template <
typename this_t,
327 template <
typename ...>
typename query_template_t,
typename ...parameters_t,
328 typename alternative_t>
329 static constexpr decltype(
auto) get_or_impl(this_t && me,
330 query_template_t<parameters_t...>
const &,
331 alternative_t && alternative)
noexcept
333 if constexpr (exists<query_template_t>())
335 return get<query_template_t>(std::forward<this_t>(me));
339 using ret_type = remove_rvalue_reference_t<
decltype(alternative)>;
340 return static_cast<ret_type
>(alternative);
352template <detail::config_element config_t>
375template <
typename lhs_config_t,
typename rhs_config_t>
379constexpr auto operator|(lhs_config_t && lhs, rhs_config_t && rhs)
381 if constexpr (detail::config_element<std::remove_cvref_t<lhs_config_t>>)
382 return configuration{std::forward<lhs_config_t>(lhs)}.
append(std::forward<rhs_config_t>(rhs));
384 return std::forward<lhs_config_t>(lhs).append(std::forward<rhs_config_t>(rhs));
418template <
template <
typename ...>
class query_t,
typename ...configs_t>
421 constexpr auto pos = pack_traits::find_if<detail::is_same_configuration_f<query_t>::template invoke, configs_t...>;
422 static_assert(pos > -1,
"Access error: The requested type is not contained.");
424 return get<pos>(config);
428template <
template <
typename ...>
class query_t,
typename ...configs_t>
431 constexpr auto pos = pack_traits::find_if<detail::is_same_configuration_f<query_t>::template invoke, configs_t...>;
432 static_assert(pos > -1,
"Access error: The requested type is not contained.");
434 return get<pos>(config);
438template <
template <
typename ...>
class query_t,
typename ...configs_t>
441 constexpr auto pos = pack_traits::find_if<detail::is_same_configuration_f<query_t>::template invoke, configs_t...>;
442 static_assert(pos > -1,
"Access error: The requested type is not contained.");
444 return get<pos>(std::move(config));
448template <
template <
typename ...>
class query_t,
typename ...configs_t>
451 constexpr auto pos = pack_traits::find_if<detail::is_same_configuration_f<query_t>::template invoke, configs_t...>;
452 static_assert(pos > -1,
"Access error: The requested type is not contained.");
456 return std::move(get<pos>(config));
471template <seqan3::detail::config_element ... configs_t>
472struct tuple_size<
seqan3::configuration<configs_t...>>
483template <
size_t pos, seqan3::detail::config_element ... configs_t>
484struct tuple_element<pos,
seqan3::configuration<configs_t...>>
Collection of elements to configure an algorithm.
Definition: configuration.hpp:45
constexpr decltype(auto) get_or(alternative_t &&alternative) const &&noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: configuration.hpp:143
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:185
constexpr size_t size() const noexcept
Returns the number of contained config elements.
Definition: configuration.hpp:86
constexpr auto remove() const
Remove a config element from the configuration.
Definition: configuration.hpp:228
configuration(config_t) -> configuration< config_t >
Deduces the correct configuration element type from the passed seqan3::pipeable_config_element.
constexpr decltype(auto) get_or(alternative_t &&alternative) &&noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: configuration.hpp:136
constexpr configuration(configuration &&)=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:122
constexpr configuration & operator=(configuration const &)=default
Defaulted.
constexpr configuration & operator=(configuration &&)=default
Defaulted.
~configuration()=default
Defaulted.
constexpr configuration(config_element_t &&config_element)
Constructs a configuration from a single configuration element.
Definition: configuration.hpp:76
constexpr decltype(auto) get_or(alternative_t &&alternative) const &noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: configuration.hpp:129
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:150
friend class configuration
Friend declaration for other instances of the configuration.
Definition: configuration.hpp:48
The <concepts> header from C++20's standard library.
Provides various auxiliary functions with which parts of the configurations can be checked.
Provides concepts for the configuration classes.
constexpr auto & get(configuration< configs_t... > &config) noexcept
Returns the stored element.
Definition: configuration.hpp:419
constexpr auto tuple_pop_front(tuple_t &&t)
Removes the first element of a tuple.
Definition: pop_front.hpp:42
decltype(detail::concat(lists_t{}...)) concat
Join two seqan3::type_list s into one.
Definition: traits.hpp:329
constexpr ptrdiff_t find
Get the index of the first occurrence of a type in a pack.
Definition: traits.hpp:187
constexpr ptrdiff_t find_if
Get the index of the first type in a pack that satisfies the given predicate.
Definition: traits.hpp:210
constexpr bool contains
Whether a type occurs in a pack or not.
Definition: traits.hpp:228
The main SeqAn3 namespace.
Definition: cigar_operation_table.hpp:2
constexpr auto const & get(configuration< configs_t... > const &config) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: configuration.hpp:429
SeqAn specific customisations in the standard namespace.
Provides seqan3::tuple_pop_front.
Type that contains multiple types.
Definition: type_list.hpp:29
Provides type traits for working with templates.
Provides type traits seqan3::detail::transfer_type_modifier_onto.
Provides seqan3::type_list.