SeqAn3
3.4.0
The Modern C++ library for sequence analysis.
Toggle main menu visibility
Loading...
Searching...
No Matches
type_list_algorithm.hpp
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
2
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
3
// SPDX-License-Identifier: BSD-3-Clause
4
9
10
#pragma once
11
12
#include <concepts>
13
#include <
type_traits
>
14
#include <
utility
>
15
16
#include <
seqan3/utility/type_list/type_list.hpp
>
17
#include <
seqan3/utility/type_pack/detail/type_pack_algorithm.hpp
>
18
19
namespace
seqan3::detail
20
{
21
23
template
<
typename
type_list_t>
24
struct
type_list_expander;
26
47
template
<
template
<
typename
...>
typename
type_list_t,
typename
... args_t>
48
struct
type_list_expander<type_list_t<args_t...>>
49
{
60
template
<
typename
fn_t>
61
requires
std::invocable<fn_t, std::type_identity<args_t>...>
62
static
constexpr
std::invoke_result_t<fn_t, std::type_identity<args_t>...> invoke_on_type_identities(fn_t && fn)
63
{
64
return
fn(std::type_identity<args_t>{}...);
65
}
66
};
67
68
//-----------------------------------------------------------------------------
69
// all_of
70
//-----------------------------------------------------------------------------
71
106
template
<
typename
type_list_t,
typename
unary_predicate_t>
107
[[nodiscard]]
constexpr
bool
all_of(unary_predicate_t && fn)
108
requires
template_specialisation_of<type_list_t, seqan3::type_list>
109
{
110
return
type_list_expander<type_list_t>::invoke_on_type_identities(
111
[&](
auto
&&... type_identities)
112
{
113
return
all_of(fn,
std::forward
<
decltype
(type_identities)>(type_identities)...);
114
});
115
}
116
117
//-----------------------------------------------------------------------------
118
// for_each
119
//-----------------------------------------------------------------------------
120
155
template
<
typename
type_list_t,
typename
unary_function_t>
156
requires
template_specialisation_of<type_list_t, seqan3::type_list>
157
constexpr
void
for_each(unary_function_t && fn)
158
{
159
type_list_expander<type_list_t>::invoke_on_type_identities(
160
[&](
auto
&&... type_identities)
161
{
162
for_each(fn,
std::forward
<
decltype
(type_identities)>(type_identities)...);
163
});
164
}
165
166
}
// namespace seqan3::detail
std::forward
T forward(T... args)
type_list.hpp
Provides seqan3::type_list.
type_pack_algorithm.hpp
Provides algorithms for meta programming, parameter packs and seqan3::type_list.
type_traits
utility
Hide me
Version:
seqan3
utility
type_list
detail
type_list_algorithm.hpp
Generated on
for SeqAn3 by
1.17.0