SeqAn3  3.2.0
The Modern C++ library for sequence analysis.
type_pack/traits.hpp File Reference

Provides various traits for template packs. More...

#include <type_traits>
#include <utility>
#include <seqan3/utility/type_list/type_list.hpp>
+ Include dependency graph for type_pack/traits.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 seqan3
 The main SeqAn3 namespace.
 
 seqan3::pack_traits
 Namespace containing traits for working on type packs.
 

Functions

Type pack traits (return a single type)
template<ptrdiff_t idx, typename... pack_t>
 seqan3::pack_traits::requires (idx >=0 &&idx< sizeof...(pack_t))||(-idx<
 Return the type at given index from the type pack. More...
 
template<typename... pack_t>
 seqan3::pack_traits::requires (sizeof...(pack_t) > 0) using front = typename decltype((std::type_identity<pack_t>{}, ...))::type
 Return the first type from the type pack. More...
 

Variables

Type pack traits (return a value)
template<typename query_t , typename... pack_t>
constexpr bool seqan3::pack_traits::contains = (find<query_t, pack_t...> != -1)
 Whether a type occurs in a pack or not. More...
 
template<typename query_t , typename... pack_t>
constexpr ptrdiff_t seqan3::pack_traits::count = (std::is_same_v<query_t, pack_t> + ... + 0)
 Count the occurrences of a type in a pack. More...
 
template<typename query_t , typename... pack_t>
constexpr ptrdiff_t seqan3::pack_traits::find = seqan3::pack_traits::detail::find<query_t, pack_t...>()
 Get the index of the first occurrence of a type in a pack. More...
 
template<template< typename > typename pred_t, typename... pack_t>
constexpr ptrdiff_t seqan3::pack_traits::find_if = seqan3::pack_traits::detail::find_if<pred_t, pack_t...>()
 Get the index of the first type in a pack that satisfies the given predicate. More...
 
template<typename... pack_t>
constexpr size_t seqan3::pack_traits::size = sizeof...(pack_t)
 The size of a type pack. More...
 

Type pack traits (return a type list)

template<typename replace_t , std::ptrdiff_t i, typename... pack_t>
 seqan3::pack_traits::requires (i >=0 &&i< size< pack_t... >) using replace_at
 Replace the type at the given index with the given type. More...
 
template<ptrdiff_t i, typename... pack_t>
 seqan3::pack_traits::requires (i >=0 &&i<=size< pack_t... >) using take = typename decltype(detail::split_after<i, pack_t...>(type_list<>{}))::second_type
 Return a seqan3::type_list of the first n types in the type pack. More...
 
template<template< typename > typename trait_t, typename... pack_t>
using seqan3::pack_traits::transform = seqan3::type_list< trait_t< pack_t >... >
 Apply a transformation trait to every type in the pack and return a seqan3::type_list of the results. More...
 

Detailed Description

Provides various traits for template packs.

Author
Rene Rahn <rene.rahn AT fu-berlin.de>