Lists of types which may be used in some of the ugmisc templates where a single type would usually be used.
More...
|
| template<class... T> |
| using | ugmisc::concatenate_type_lists_t = typename concatenate_type_lists<T...>::type |
| template<class T> |
| using | ugmisc::get_as_list_t = typename get_as_list<T>::type |
| template<std::size_t I, class T> |
| using | ugmisc::type_list_member |
| template<class... T> |
| using | ugmisc::flatten_t = typename flatten<T...>::type |
| | Converts the template parameters into a type_list.
|
| template<std::size_t From, std::size_t To, class T> |
| using | ugmisc::type_list_sublist = typename get_type_list_sublist<From, To, T>::type |
| template<std::size_t From, std::size_t Count, class T> |
| using | ugmisc::type_list_sized_sublist = type_list_sublist<From, From + Count, T> |
| template<std::size_t Count, class T> |
| using | ugmisc::type_list_prefix = type_list_sublist<0, Count, T> |
| template<std::size_t Count, class T> |
| using | ugmisc::type_list_suffix = type_list_sublist<T::size - Count, T::size, T> |
| template<std::size_t Count, class T> |
| using | ugmisc::type_list_remove_prefix = type_list_sublist<Count, T::size, T> |
| template<std::size_t Count, class T> |
| using | ugmisc::type_list_remove_suffix = type_list_sublist<0, T::size-Count, T> |
| template<std::size_t From, std::size_t To, class... T> |
| using | ugmisc::flatten_sublist = type_list_sublist<From, To, flatten_t<T...>> |
| template<std::size_t From, std::size_t Count, class... T> |
| using | ugmisc::flatten_sized_sublist = type_list_sized_sublist<From, Count, flatten_t<T...>> |
| template<std::size_t Count, class... T> |
| using | ugmisc::flatten_prefix = type_list_prefix<Count, flatten_t<T...>> |
| template<std::size_t Count, class... T> |
| using | ugmisc::flatten_suffix = type_list_suffix<Count, flatten_t<T...>> |
| template<std::size_t Count, class... T> |
| using | ugmisc::flatten_remove_prefix = type_list_remove_prefix<Count, flatten_t<T...>> |
| template<std::size_t Count, class... T> |
| using | ugmisc::flatten_remove_suffix = type_list_remove_suffix<Count, flatten_t<T...>> |
| template<template< class > class Test, class T, test_modifier Mod = no_invert_test> |
| using | ugmisc::type_list_filter |
| template<template< class > class Test, class T, test_modifier Mod = static_cast<test_modifier>(0)> |
| using | ugmisc::filter_type_list = type_list_filter<Test, T, Mod> |
| template<template< class > class F, class T> |
| using | ugmisc::type_list_apply_each_class = typename typelist_::apply_each<F, T>::class_types |
| template<template< class > class F, class T> |
| using | ugmisc::type_list_apply_each = typename typelist_::apply_each<F, T>::inner_types |
| template<template< class > class F, class... T> |
| using | ugmisc::flatten_apply_each_class = type_list_apply_each_class<F, flatten_t<T...>> |
| template<template< class > class F, class... T> |
| using | ugmisc::flatten_apply_each = type_list_apply_each<F, flatten_t<T...>> |
| template<template< class > class Test, test_modifier Mod, class... T> |
| using | ugmisc::flatten_filter = type_list_filter<Test, flatten_t<T...>, Mod> |
| template<std::ptrdiff_t Base, std::ptrdiff_t Stride, std::size_t Count, class T> |
| using | ugmisc::type_list_stride |
| template<std::ptrdiff_t Base, std::ptrdiff_t Stride, std::size_t Count, class... T> |
| using | ugmisc::flatten_stride = type_list_stride<Base, Stride, Count, flatten_t<T...>> |
Lists of types which may be used in some of the ugmisc templates where a single type would usually be used.
Why?
The member.hpp header finds this stuff useful. You might too.
List of types can be manipulated easily, as if they are lists of objects.
Operations
Some operations are templates which come in two variants.
- flatten_ prefixed template type aliases
- type_list_ prefixed template type aliases
The flatten_ variants are more flexible, and will always work as a drop in replacement for their type_list_ twins. That might not be what you want though. If you think you have an instance of the type_list<> template to pass to e.g. flatten_filter then using type_list_filter is effectively like doing the same thing but also making a static assertion that it is indeed a type_list.
Operations include adding and removing prefixes and suffixes or taking sublists from type_lists, filtering out some of the members of a type_list, and concatenating two or more type_lists.
Converts the template parameters into a type_list.
Every parameter which is itself a type_list is unrolled. Every wrapped_list is unwrapped (but not recursively).
So for example:
flatten_t< typelist<A, B>, C, wrapped_list<typelist<D, E, F> >
is the type:
typelist<A, B, C, typelist<D, E, F> >
The implementation uses some single-arg template specializations to distinguish between template args which are type_list, wrapped_list, or neither. Then the non-specialised flatten concatenates the types produced by those.
A wrapped_list should be unwrapped once, whereas a type_list should be unwrapped recursively.
template<class T, class U>
Concatenate type lists, using instances of the type lists. A type list is a type, not an object. However, it can be instantiated, and is a trivial empty class.
Instances can be added, and the resulting object is an instance of the type that would be produced by concatenating the two type lists.