rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
type_list.hpp
1// SPDX-License-Identifier: GPL-3.0-only
2
3#pragma once
4
5#include <type_traits>
6#include <cstddef>
7
8namespace rexlib
9{
10
19template <typename... Ts>
20struct type_list {};
21
27template <typename T>
29
30template <typename... Ts>
32 : std::integral_constant<std::size_t, sizeof...(Ts)>
33{
34};
35
41template<std::size_t I, typename T>
43
44template<std::size_t I, typename Head, typename... Tail>
46 : type_list_element<I - 1, type_list<Tail...>>
47{
48};
49
50template<class Head, typename... Tail>
52{
53 using type = Head;
54};
55
62template <typename T, typename List>
64
65template <typename T, typename... Ts>
67{
68 using type = type_list<T, Ts...>;
69};
70
78template <typename T, std::size_t N>
80{
81 using type = typename type_list_prepend<
82 T,
83 typename repeated_type_list<T, N - 1>::type
84 >::type;
85};
86
87template <typename T>
89{
90 using type = type_list<>;
91};
92
98template <typename... Lists>
100
101template <typename... Ts>
103{
104 using type = type_list<Ts...>;
105};
106
107template <typename... As, typename... Bs, typename... Rest>
109 : type_list_cat<type_list<As..., Bs...>, Rest...>
110{
111};
112
118template <typename... Lists>
119using type_list_cat_t = typename type_list_cat<Lists...>::type;
120
121} // namespace rexlib
Container for multidimensional numeric data.
Definition array.hpp:31
Arrays, the operations on them and the devices that run those operations.
Definition cpu_device.hpp:10
typename type_list_cat< Lists... >::type type_list_cat_t
Convenience alias for type_list_cat<Lists...>::type.
Definition type_list.hpp:119
Utility class to obtain a type_list with a type repeated a fixed number of times.
Definition type_list.hpp:80
Utility class to concatenate an arbitrary number of type_list-s.
Definition type_list.hpp:99
Utility class to index a type on a type_list.
Definition type_list.hpp:42
Utility class to prepend a type to the front of a type_list.
Definition type_list.hpp:63
Utility class to obtain the size of a type_list.
Definition type_list.hpp:28
Helper class to pass a heterogeneous sequence of types to a function.
Definition type_list.hpp:20