mrs_lib
Various reusable classes, functions and utilities for use in MRS projects
Loading...
Searching...
No Matches
meta.hpp
1#ifndef MRS_LIB_UTILITY_META_HPP_
2#define MRS_LIB_UTILITY_META_HPP_
3
4#include <cstddef>
5
6
11{
12
16 template <typename...>
17 struct TypeList
18 {
19 };
20
29 template <typename List, size_t N>
30 struct Drop; // Undefined
31
32 template <typename... Ts>
33 struct Drop<TypeList<Ts...>, size_t(0)>
34 {
35 using type = TypeList<Ts...>;
36 };
37
38 template <typename T, typename... Ts, size_t N>
39 requires(N > 0)
40 struct Drop<TypeList<T, Ts...>, N>
41 {
42 using type = Drop<TypeList<Ts...>, N - 1>::type;
43 };
44
48 template <typename List, size_t N>
50
59 template <template <typename...> typename F, typename List>
60 struct Apply; // Undefined
61
62 template <template <typename...> typename F, typename... Args>
63 struct Apply<F, TypeList<Args...>>
64 {
65 using type = F<Args...>;
66 };
67
71 template <template <typename...> typename F, typename List>
73
74} // namespace mrs_lib::meta
75
76
77#endif // MRS_LIB_UTILITY_META_HPP_
Namespace containing metaprograming utilities.
Definition meta.hpp:11
Apply< F, List >::type ApplyT
Helper type alias for Apply<F, List>::type.
Definition meta.hpp:72
Drop< List, N >::type DropT
Helper type alias for Drop<List, N>::type.
Definition meta.hpp:49
Apply metafunction to TypeList of argument types.
Definition meta.hpp:60
Metafunction to drop first N types from TypeList.
Definition meta.hpp:30
Struct for storing compile time list of types.
Definition meta.hpp:18