Provides seqan3::type_list and metaprogramming utilities for working on type lists. More...
Classes | |
struct | seqan3::type_list< types > |
Type that contains multiple types. More... | |
Type list traits (return a type list) | |
template<template< typename > typename trait_t, typename list_t > | |
using | seqan3::list_traits::transform = decltype(detail::transform< trait_t >(list_t{})) |
Apply a transformation trait to every type in the list and return a seqan3::type_list of the results. More... | |
template<size_t count, typename t > | |
using | seqan3::list_traits::repeat = decltype(detail::repeat< count, t >()) |
Create a type list with the given type repeated count times.. More... | |
seqan3::list_traits::list_t | |
Apply a transformation trait to every type in the list and return a seqan3::type_list of the results. More... | |
template<typename... lists_t> | |
seqan3::list_traits::requires (seqan3::detail::template_specialisation_of< lists_t, seqan3::type_list > &&...) using concat | |
Join two seqan3::type_list s into one. More... | |
template<typename replace_t , std::ptrdiff_t i, typename list_t > | |
seqan3::list_traits::requires (seqan3::detail::template_specialisation_of< list_t, seqan3::type_list >) &&(i >=0 &&i< size< list_t >) using replace_at | |
Replace the type at the given index with the given type. More... | |
Type list traits (return a value) | |
template<typename... pack_t> | |
constexpr size_t | seqan3::list_traits::size< type_list< pack_t... > > = sizeof...(pack_t) |
The size of a type list. More... | |
template<typename query_t , typename... pack_t> | |
constexpr ptrdiff_t | seqan3::list_traits::count< query_t, type_list< pack_t... > > = seqan3::pack_traits::count<query_t, pack_t...> |
Count the occurrences of a type in a type list. More... | |
template<typename query_t , typename... pack_t> | |
constexpr ptrdiff_t | seqan3::list_traits::find< query_t, type_list< pack_t... > > |
Get the index of the first occurrence of a type in a type list. More... | |
template<template< typename > typename pred_t, typename... pack_t> | |
constexpr ptrdiff_t | seqan3::list_traits::find_if< pred_t, type_list< pack_t... > > |
Get the index of the first type in a type list that satisfies the given predicate. More... | |
template<typename query_t , typename list_t > | |
requires constexpr seqan3::detail::template_specialisation_of< list_t, seqan3::type_list > bool | seqan3::list_traits::contains = (find<query_t, list_t> != -1) |
Whether a type occurs in a type list or not. More... | |
Type list traits (return a single type) | |
template<ptrdiff_t idx, typename list_t > | |
seqan3::list_traits::requires (seqan3::detail::template_specialisation_of< list_t, seqan3::type_list >) &&((idx >=0 &&idx< size< list_t >)||(-idx< | |
Return the type at given index from the type list. More... | |
template<typename list_t > | |
seqan3::list_traits::requires (seqan3::detail::template_specialisation_of< list_t, seqan3::type_list >) &&(size< list_t > > 0) using front = typename decltype(detail::back(list_t{}))::type | |
Return the first type from the type list. More... | |
Provides seqan3::type_list and metaprogramming utilities for working on type lists.
All traits on type lists are defined in the header <seqan3/utility/type_list/traits.hpp>
.
using seqan3::list_traits::repeat = typedef decltype(detail::repeat<count, t>()) |
Create a type list with the given type repeated count
times..
count | The number of repititions. |
t | The type to repeat |
However, with a constant of 0.2, e.g. repeat<10,int> results in 2-3 instantiations.
using seqan3::list_traits::transform = typedef decltype(detail::transform<trait_t>(list_t{})) |
Apply a transformation trait to every type in the list and return a seqan3::type_list of the results.
trait_t | The trait to transform, must be an alias template, e.g. a transformation trait shortcut. |
list_t | The (input) type list. |
The transformation trait given as first argument must be an alias template, e.g. std::type_identity_t, not std::type_identity. The alias must take exactly one argument and be defined for all types in the input list.
|
pure virtual |
Return the type at given index from the type list.
Replace the type at the given index with the given type.
Return the first type from the type list.
Split a seqan3::type_list into two parts returned as a pair of seqan3::type_list.
Return a seqan3::type_list of the types the input type list, except the last n
.
Return a seqan3::type_list of the last n
types in the input type list.
Return a seqan3::type_list of the types in the input type list, except the first n
.
Return a seqan3::type_list of the first n
types in the input type list.
idx | The index; must be smaller than the size of the type list. |
list_t | The type_list. |
Negative indexes are supported (e.g. at<-1, type_list<int, double, bool &>>
is bool &
).
i | The target size; must be >= 0 and <= the size of the input type list. |
list_t | The (input) type list. |
i | The amount to drop; must be >= 0 and <= the size of the input type list. |
list_t | The (input) type list. |
i | The target size; must be >= 0 and <= the size of the input type list. |
list_t | The (input) type list. |
i | The amount to drop; must be >= 0 and <= the size of the input type list. |
list_t | The (input) type list. |
i | The number of elements after which to split; must be >= 0 and <= the size of the input type list. |
list_t | The (input) type list. |
|
pure virtual |
Replace the type at the given index with the given type.
replace_t | The type to replace the old type with. |
i | The index of the type to be replaced. |
list_t | The (input) type list. |
Replace the type at the given index with the given type.
Return the first type from the type list.
Split a seqan3::type_list into two parts returned as a pair of seqan3::type_list.
Return a seqan3::type_list of the types the input type list, except the last n
.
Return a seqan3::type_list of the last n
types in the input type list.
Return a seqan3::type_list of the types in the input type list, except the first n
.
Return a seqan3::type_list of the first n
types in the input type list.
idx | The index; must be smaller than the size of the type list. |
list_t | The type_list. |
Negative indexes are supported (e.g. at<-1, type_list<int, double, bool &>>
is bool &
).
i | The target size; must be >= 0 and <= the size of the input type list. |
list_t | The (input) type list. |
i | The amount to drop; must be >= 0 and <= the size of the input type list. |
list_t | The (input) type list. |
i | The target size; must be >= 0 and <= the size of the input type list. |
list_t | The (input) type list. |
i | The amount to drop; must be >= 0 and <= the size of the input type list. |
list_t | The (input) type list. |
i | The number of elements after which to split; must be >= 0 and <= the size of the input type list. |
list_t | The (input) type list. |
seqan3::list_traits::requires | ( | seqan3::detail::template_specialisation_of< list_t, seqan3::type_list > | ) | && = typename decltype(detail::back(list_t{}))::type |
Return the first type from the type list.
Return a seqan3::type_list of all the types in the type list, except the first.
Return the last type from the type list.
list_t | The type list. |
list_t | The type list. |
Notably faster than seqan3::pack_traits::at<size<pack...> - 1, pack...>
(no recursive template instantiations).
list_t | The (input) type list. |
Return the first type from the type list.
Split a seqan3::type_list into two parts returned as a pair of seqan3::type_list.
Return a seqan3::type_list of the types the input type list, except the last n
.
Return a seqan3::type_list of the last n
types in the input type list.
Return a seqan3::type_list of the types in the input type list, except the first n
.
Return a seqan3::type_list of the first n
types in the input type list.
idx | The index; must be smaller than the size of the type list. |
list_t | The type_list. |
Negative indexes are supported (e.g. at<-1, type_list<int, double, bool &>>
is bool &
).
i | The target size; must be >= 0 and <= the size of the input type list. |
list_t | The (input) type list. |
i | The amount to drop; must be >= 0 and <= the size of the input type list. |
list_t | The (input) type list. |
i | The target size; must be >= 0 and <= the size of the input type list. |
list_t | The (input) type list. |
i | The amount to drop; must be >= 0 and <= the size of the input type list. |
list_t | The (input) type list. |
i | The number of elements after which to split; must be >= 0 and <= the size of the input type list. |
list_t | The (input) type list. |
seqan3::list_traits::requires | ( | seqan3::detail::template_specialisation_of< lists_t, seqan3::type_list > && | ... | ) |
Join two seqan3::type_list s into one.
list1_t | The first (input) type list. |
list2_t | The second (input) type list. |
Complexity is independent of the number of types in each list.
|
inlineconstexpr |
Whether a type occurs in a type list or not.
query_t | The type you are searching for. |
pack_t | The type pack. |
true
or false
.i
, where i
is the index of the first occurrence
|
inlineconstexpr |
Count the occurrences of a type in a type list.
query_t | The type you are searching for. |
pack_t | The type pack. |
query_t
in pack_t
.
|
inlineconstexpr |
Get the index of the first occurrence of a type in a type list.
query_t | The type you are searching for. |
pack_t | The type pack. |
query_t
in pack_t
or -1
if it is not contained.i
, where i
is the return value
|
inlineconstexpr |
Get the index of the first type in a type list that satisfies the given predicate.
pred_t | The predicate that is being evaluated (a class template). |
pack_t | The type pack. |
-1
if no types match.Note that the predicate must be given as a type template (variable templates cannot be passed as template arguments unfortunately). This means e.g. find_if<std::is_integral, float, double, int, float>
(not std::is_integral_v
!).
i
, where i
is the return valueOther operations: O(n), possibly == i
, where i
is the return value
Only the predicate is instantiated.
seqan3::list_traits::list_t |
Apply a transformation trait to every type in the list and return a seqan3::type_list of the results.
trait_t | The trait to transform, must be an alias template, e.g. a transformation trait shortcut. |
list_t | The (input) type list. |
The transformation trait given as first argument must be an alias template, e.g. std::type_identity_t, not std::type_identity. The alias must take exactly one argument and be defined for all types in the input list.
|
inlineconstexpr |
The size of a type list.
pack_t | The type pack. |
sizeof...(pack_t)