Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
apply_each.hpp
Go to the documentation of this file.
1// Copyright 2026, Toyota Motor Corporation
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_LIST_APPLY_EACH_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_LIST_APPLY_EACH_HPP_
7
8// IWYU pragma: private, include "arene/base/type_list.hpp"
9// IWYU pragma: friend "(arene/base(?!/tests)|stdlib/include/stdlib_detail)/.*"
10
11namespace arene {
12namespace base {
13namespace type_lists {
14
15/// @brief Apply the given template individually to every element of the given type list
16/// @tparam TypeList The type list to whose elements @c ToApply should be applied
17/// @tparam ToApply The template to apply to each element of @c TypeList
18template <class TypeList, template <class...> class ToApply>
19struct apply_each;
20
21/// @brief Apply the given template individually to every element of the given type list
22/// @tparam TypeList The type list to whose elements @c ToApply should be applied
23/// @tparam Types The individual types contained by this specialization of @c TypeList
24/// @tparam ToApply The template to apply to each type in @c Types
25template <template <class...> class TypeList, typename... Types, template <class...> class ToApply>
26struct apply_each<TypeList<Types...>, ToApply> {
27 /// @brief A new @c TypeList specialization whose parameters are @c ToApply<Types...> instead of @c Types...
28 using type = TypeList<ToApply<Types>...>;
29};
30
31/// @brief Apply the given template individually to every element of the given type list
32/// @tparam TypeList The type list to whose elements @c ToApply should be applied
33/// @tparam ToApply The template to apply to each element of @c TypeList
34template <class TypeList, template <class...> class ToApply>
35using apply_each_t = typename apply_each<TypeList, ToApply>::type;
36
37} // namespace type_lists
38} // namespace base
39} // namespace arene
40
41#endif // INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_LIST_APPLY_EACH_HPP_
Definition apply_all.hpp:14
Definition array_exceptions_disabled.cpp:11
Copyright 2026, Toyota Motor Corporation.
Definition array_exceptions_disabled.cpp:10