SeqAn3 3.3.0-rc.1
The Modern C++ library for sequence analysis.
type_pack_algorithm.hpp
Go to the documentation of this file.
1// -----------------------------------------------------------------------------------------------------
2// Copyright (c) 2006-2022, Knut Reinert & Freie Universität Berlin
3// Copyright (c) 2016-2022, 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
13#pragma once
14
15#include <concepts>
16#include <type_traits>
17#include <utility>
18
20
21namespace seqan3::detail
22{
23
24//-----------------------------------------------------------------------------
25// all_of
26//-----------------------------------------------------------------------------
27
58template <typename unary_predicate_t, typename... pack_t>
59 requires (std::predicate<unary_predicate_t, pack_t> && ...)
60constexpr bool all_of(unary_predicate_t && fn, pack_t &&... args)
61{
62 return (fn(std::forward<pack_t>(args)) && ...);
63}
64
65//-----------------------------------------------------------------------------
66// for_each
67//-----------------------------------------------------------------------------
68
96template <typename unary_function_t, typename... pack_t>
97 requires (std::invocable<unary_function_t, pack_t> && ...)
98constexpr void for_each(unary_function_t && fn, pack_t &&... args)
99{
100 (fn(std::forward<pack_t>(args)), ...);
101}
102
103} // namespace seqan3::detail
constexpr bool all_of(unary_predicate_t &&fn)
Tests whether a given predicate evaluates to true for each type in a seqan3::type_list.
Definition: type_list_algorithm.hpp:110
constexpr void for_each(unary_function_t &&fn)
Applies a function element wise to all types of a type list.
Definition: type_list_algorithm.hpp:160
The internal SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
Provides platform and dependency checks.