77template<
class...T>
struct type_list_common {
78 static constexpr std::size_t size =
sizeof...(T);
80 template<
template<
class...>
class Templ>
using apply = Templ<T...>;
95template<>
struct type_list<> :
public typelist_::type_list_common<> {
99template<
class T1,
class...Ts>
struct type_list<T1, Ts...>
100:
public typelist_::type_list_common<T1, Ts...>
106template<std::
size_t I,
class T>
struct get_type_list_member {};
110template<std::size_t I,
class T1,
class...T>
111struct get_type_list_member<I,
type_list<T1, T...>> {
112 static_assert( I <
sizeof...(T) + 1,
"Index out of range" );
113 using type =
typename get_type_list_member<I-1, type_list<T...>>::type;
116template<
class T1,
class...T>
struct get_type_list_member<0,
type_list<T1, T...>> {
120template<std::
size_t I,
class T>
using type_list_member =
121 typename get_type_list_member<I, T>::type;
128template<
class T>
struct is_type_list :
public std::false_type {};
130template<
class...T>
struct is_type_list<
type_list<T...>> : std::true_type {};
132template<
class T>
static constexpr bool is_type_list_v = is_type_list<T>::value;
135template<
class...T>
static constexpr bool are_type_lists_v = (... && is_type_list_v<T>);
140template<
class...>
struct concatenate_type_lists;
143template<>
struct concatenate_type_lists<> {
144 using type = type_list<>;
148template<
class...T>
struct concatenate_type_lists<
type_list<T...>> {
149 using type = type_list<T...>;
153template<
class T1,
class T2,
class T3,
class...Ts>
struct concatenate_type_lists<T1, T2, T3, Ts...> {
154 static_assert( are_type_lists_v<T1, T2, T3, Ts...> );
155 using type =
typename concatenate_type_lists<
156 typename concatenate_type_lists<T1, T2>::type,
157 typename concatenate_type_lists<T3, Ts...>::type
162template<
class T,
class...Ts>
163struct concatenate_type_lists< T,
type_list<Ts...> >
165 static_assert( is_type_list_v<T> );
166 using type =
typename T::template append<Ts...>;
199template<std::
size_t From, std::
size_t To,
class T>
struct get_type_list_slice;
201template<std::size_t From,
class...T>
202struct get_type_list_slice<From, From,
type_list<T...>> {
203 static_assert( From <=
sizeof...(T) );
204 using type = type_list<>;
207template<std::size_t From,
class...T>
208struct get_type_list_slice<From, From+1, type_list<T...>> {
209 static_assert( From <
sizeof...(T) );
211 type_list<
typename get_type_list_member<From, type_list<T...>>::type >;
214template<std::size_t From, std::size_t To,
class...T>
215struct get_type_list_slice<From, To,
type_list<T...>> {
217 static_assert( To >= From,
"Invalid range: To must be no less than From." );
218 static_assert( To > From+1,
"Logic error. Wrong partial specialisation." );
220 using list = type_list<T...>;
222 static constexpr std::size_t from1 = From;
223 static constexpr std::size_t to1 = From + (To - From)/2;
224 static constexpr std::size_t from2 = to1;
225 static constexpr std::size_t to2 = To;
227 using part1 =
typename get_type_list_slice<from1, to1, list>::type;
228 using part2 =
typename get_type_list_slice<from2, to2, list>::type;
231 using type = concatenate_type_lists_t< part1, part2 >;
261template<
class T>
struct get_as_list {
262 using type = type_list<T>;
266template<
class...T>
struct get_as_list<
type_list<T...>> {
267 using type = type_list<T...>;
271template<
class T>
using get_as_list_t =
typename get_as_list<T>::type;
274template<
class T>
struct unwrap {
317template<
class T>
struct flatten<T> {
326template<
class...T>
struct flatten< type_list<T...> > {
327 using type = concatenate_type_lists_t<typename flatten<T>::type...>;
335 using type = type_list<T>;
339template<
class...T>
using flatten_t =
typename flatten<T...>::type;
352template<std::
size_t From, std::
size_t To,
class T>
358template<std::
size_t From, std::
size_t Count,
class T>
367template<std::
size_t Count,
class T>
376template<std::
size_t Count,
class T>
385template<std::
size_t Count,
class T>
394template<std::
size_t Count,
class T>
404template<std::size_t From, std::size_t To,
class...T>
410template<std::size_t From, std::size_t Count,
class...T>
416template<std::size_t Count,
class...T>
422template<std::size_t Count,
class...T>
431template<std::size_t Count,
class...T>
440template<std::size_t Count,
class...T>
Converts the template parameters into a type_list.
Definition typelist.hpp:306
Definition typelist.hpp:69
Definition typelist.hpp:246
type_list_slice< T::size - Count, T::size, T > type_list_suffix
Definition typelist.hpp:377
type_list_sized_slice< From, Count, flatten_t< T... > > flatten_sized_slice
Definition typelist.hpp:411
type_list_remove_prefix< Count, flatten_t< T... > > flatten_remove_prefix
Definition typelist.hpp:432
type_list_slice< From, To, flatten_t< T... > > flatten_slice
Definition typelist.hpp:405
type_list_prefix< Count, flatten_t< T... > > flatten_prefix
Definition typelist.hpp:417
type_list_slice< From, From+Count, T > type_list_sized_slice
Definition typelist.hpp:359
type_list_slice< 0, Count, T > type_list_prefix
Definition typelist.hpp:368
type_list_slice< Count, T::size, T > type_list_remove_prefix
Definition typelist.hpp:386
typename get_type_list_slice< From, To, T >::type type_list_slice
Definition typelist.hpp:353
type_list_remove_suffix< Count, flatten_t< T... > > flatten_remove_suffix
Definition typelist.hpp:441
typename concatenate_type_lists< T... >::type concatenate_type_lists_t
Definition typelist.hpp:194
type_list_slice< 0, T::size-Count, T > type_list_remove_suffix
Definition typelist.hpp:395
type_list_suffix< Count, flatten_t< T... > > flatten_suffix
Definition typelist.hpp:423