Drake
type_pack.h File Reference

Basic meta-programming utilities for types, focused on template parameter packs. More...

#include <cstddef>
#include <type_traits>
#include <typeindex>
#include <typeinfo>
#include <utility>
Include dependency graph for type_pack.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  type_pack< Ts >
 Provides a tag to pass a parameter packs for ease of inference. More...
 
struct  type_at_impl< N, K, T, Ts >
 
struct  type_at_impl< N, N, T, Ts... >
 
struct  type_visit_impl< VisitWith, Visitor >
 
struct  type_visit_impl< VisitWith, Visitor >::runner< T, execute >
 
struct  type_visit_impl< VisitWith, Visitor >::runner< T, false >
 
struct  type_pack_extract_impl< T >
 
struct  type_pack_extract_impl< Tpl< Ts... > >
 
struct  assert_default_constructible< T >
 
struct  type_at< I, Ts >
 Extracts the Ith type from a sequence of types. More...
 
struct  type_tag< T >
 Provides a tag to pass a type for ease of inference. More...
 
struct  template_single_tag< Tpl >
 Provides a tag for single-parameter templates. More...
 
struct  type_pack< Ts >
 Provides a tag to pass a parameter packs for ease of inference. More...
 
struct  type_visit_with_default
 Visit a type by constructing its default value. More...
 
struct  type_visit_with_tag< Tag >
 Visits a type by construct a template tag's default value. More...
 
struct  type_check_different_from< T >
 Provides a check which returns whether T is different than U. More...
 

Namespaces

 drake
 
 drake::detail
 

Typedefs

using DummyList = bool[]
 
template<typename T >
using type_pack_extract = typename detail::type_pack_extract_impl< T >::type
 Extracts the inner template arguments (typename only) for a typename which is a template instantiation. More...
 
template<typename T >
using type_check_always_true = std::true_type
 Provides a check which will return true for any type. More...
 
template<typename T >
using negation = std::integral_constant< bool, !T::value >
 Provides backport of C++17 std::negation. More...
 

Functions

template<template< typename... > class Tpl, typename ... Ts>
Tpl< Ts... > type_bind (type_pack< Ts... >)
 Returns an expression (only to be used in decltype) for inferring and binding a parameter pack to a template. More...
 
template<class VisitWith = type_visit_with_default, template< typename > class Predicate = type_check_always_true, typename Visitor = void, typename ... Ts>
void type_visit (Visitor &&visitor, type_pack< Ts... >={}, template_single_tag< Predicate >={})
 Visits each type in a type pack. More...
 
template<typename T >
constexpr size_t type_hash ()
 Provides short-hand for hashing a type. More...
 

Detailed Description

Basic meta-programming utilities for types, focused on template parameter packs.