SeqAn3  3.0.0
The Modern C++ library for sequence analysis.
parameter_pack.hpp
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2019, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2019, Knut Reinert & MPI für molekulare Genetik
4 // This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
5 // shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md
6 // -----------------------------------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <utility>
11 
12 #include <seqan3/std/concepts>
13 #include <seqan3/std/type_traits>
14 
15 namespace seqan3::detail
16 {
17 
39 template <typename unary_function_t, typename ...args_t>
41  requires (std::Invocable<unary_function_t, args_t> && ... && true)
43 constexpr void for_each_value(unary_function_t && fn, args_t && ...args)
44 {
45  [[maybe_unused]] int r = (fn(std::forward<args_t>(args)), ..., 0);
46 }
47 
67 template <typename ...types, typename unary_function_t>
69  requires (std::Invocable<unary_function_t, std::type_identity<types>> && ... && true)
71 constexpr void for_each_type(unary_function_t && fn)
72 {
73  for_each_value(std::forward<unary_function_t>(fn), std::type_identity<types>{}...);
74 }
75 
101 template <template <typename...> typename type_list_t, typename ...args_t, typename unary_function_t>
103  requires (std::Invocable<unary_function_t, std::type_identity<args_t>> && ... && true)
105 constexpr void for_each_type(unary_function_t && fn, type_list_t<args_t...> const & SEQAN3_DOXYGEN_ONLY(type_list))
106 {
107  for_each_type<args_t...>(std::forward<unary_function_t>(fn));
108 }
109 
110 } // namespace seqan3::detail
The Concepts library.
Definition: aligned_sequence_concept.hpp:35
Provides C++20 additions to the type_traits header.
meta::list< types... > type_list
Type that contains multiple types, an alias for meta::list.
Definition: type_list.hpp:27
The identity transformation (a TransformationTrait that returns the input).
Definition: type_traits:30
Specifies whether the given callable is invocable with the given arguments.