Loading...
Searching...
No Matches
type_list_algorithm.hpp
Go to the documentation of this file.
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: BSD-3-Clause
#pragma once
#include <concepts>
#include <type_traits>
#include <utility>
#include <seqan3/utility/type_list/type_list.hpp>
#include <seqan3/utility/type_pack/detail/type_pack_algorithm.hpp>
namespace seqan3::detail
{
template <typename type_list_t>
struct type_list_expander;
template <template <typename...> typename type_list_t, typename... args_t>
struct type_list_expander<type_list_t<args_t...>>
{
template <typename fn_t>
requires std::invocable<fn_t, std::type_identity<args_t>...>
static constexpr std::invoke_result_t<fn_t, std::type_identity<args_t>...> invoke_on_type_identities(fn_t && fn)
{
return fn(std::type_identity<args_t>{}...);
}
};
//-----------------------------------------------------------------------------
// all_of
//-----------------------------------------------------------------------------
template <typename type_list_t, typename unary_predicate_t>
[[nodiscard]] constexpr bool all_of(unary_predicate_t && fn)
requires template_specialisation_of<type_list_t, seqan3::type_list>
{
return type_list_expander<type_list_t>::invoke_on_type_identities(
[&](auto &&... type_identities)
{
return all_of(fn, std::forward<decltype(type_identities)>(type_identities)...);
});
}
//-----------------------------------------------------------------------------
// for_each
//-----------------------------------------------------------------------------
template <typename type_list_t, typename unary_function_t>
requires template_specialisation_of<type_list_t, seqan3::type_list>
constexpr void for_each(unary_function_t && fn)
{
type_list_expander<type_list_t>::invoke_on_type_identities(
[&](auto &&... type_identities)
{
for_each(fn, std::forward<decltype(type_identities)>(type_identities)...);
});
}
} // 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