UgMisc 0.3
Miscellaneous C++ header library
Loading...
Searching...
No Matches
ugmisc::type_list< T > Struct Template Reference

Encapsulates a list of types. More...

#include <ugmisc/typelist.hpp>

Public Types

template<template< class... > class Templ>
using apply_t = Templ<T...>
template<template< class... > class Templ>
using apply = apply_t<Templ>
template<template< class... > class Templ>
using call_t
template<template< class... > class Templ>
using call = call_t<Templ>
template<class... U>
using prepend_t = type_list<U..., T...>
template<class... U>
using append_t = type_list<T..., U...>
template<std::size_t From, std::size_t To>
using sublist_t = type_list_sublist<From, To, type_list>
template<std::ptrdiff_t Base, std::ptrdiff_t Stride, std::size_t Count>
using stride_t = type_list_stride<Base, Stride, Count, type_list>

Static Public Member Functions

template<class... U>
static constexpr prepend_t< U... > prepend (type_list< U... >)
template<class... U>
static constexpr append_t< U... > append (type_list< U... >)
template<class... U>
static constexpr sublist_method_return< U... > sublist (U...)
template<class... U>
static constexpr stride_method_return< U... > stride (U...)

Static Public Attributes

static constexpr std::size_t size = sizeof...(T)
 Number of types in the list.

Detailed Description

template<class... T>
struct ugmisc::type_list< T >

Encapsulates a list of types.

Definition at line 860 of file typelist.hpp.

Member Typedef Documentation

◆ append_t

template<class... T>
template<class... U>
using ugmisc::type_list< T >::append_t = type_list<T..., U...>

A type_list with the type arguments appended.

Definition at line 938 of file typelist.hpp.

◆ apply

template<class... T>
template<template< class... > class Templ>
using ugmisc::type_list< T >::apply = apply_t<Templ>
Deprecated
This is an alias of apply_t. The name apply will be used for a static constexpr method template in the future.

Definition at line 891 of file typelist.hpp.

◆ apply_t

template<class... T>
template<template< class... > class Templ>
using ugmisc::type_list< T >::apply_t = Templ<T...>

Feed the types into a template as template arguments.

See also
call_t

Definition at line 884 of file typelist.hpp.

◆ call

template<class... T>
template<template< class... > class Templ>
using ugmisc::type_list< T >::call = call_t<Templ>
Deprecated
This is an alias of call_t. The name call will be used for a static constexpr method template in the future.

Definition at line 905 of file typelist.hpp.

◆ call_t

template<class... T>
template<template< class... > class Templ>
using ugmisc::type_list< T >::call_t
Initial value:
typename Templ<T...>::type

Like apply_t, but treats the template as a metafunction whose return value is a type member called type.

Definition at line 897 of file typelist.hpp.

◆ prepend_t

template<class... T>
template<class... U>
using ugmisc::type_list< T >::prepend_t = type_list<U..., T...>

A type_list with the type arguments prepended.

Definition at line 911 of file typelist.hpp.

◆ stride_t

template<class... T>
template<std::ptrdiff_t Base, std::ptrdiff_t Stride, std::size_t Count>
using ugmisc::type_list< T >::stride_t = type_list_stride<Base, Stride, Count, type_list>
See also
type_list_stride

Definition at line 997 of file typelist.hpp.

◆ sublist_t

template<class... T>
template<std::size_t From, std::size_t To>
using ugmisc::type_list< T >::sublist_t = type_list_sublist<From, To, type_list>

A sublist of this list, including each type element from and including the From index up to but not including the To index.

Template Parameters
FromThe first type element index.
ToThe end index.
See also
type_list_sublist

Definition at line 971 of file typelist.hpp.

Member Function Documentation

◆ append()

template<class... T>
template<class... U>
constexpr append_t< U... > ugmisc::type_list< T >::append ( type_list< U... > )
inlinestaticconstexpr

Return an object whose type is the type list with the argument type list's types appended.

// X, Y, and Z are all ugmisc::type_list<A, B, C, D>.
T t;
A a;;
using X = T::append_t<C, D>;
using Y = decltype( t.append(a) );
using Z = decltype( T::append(a) );
Encapsulates a list of types.
Definition typelist.hpp:860

This allows type_lists to be used as objects while they are being manipulated, and then the type of the resulting object can be taken, which may be more expressive and legible.

Definition at line 959 of file typelist.hpp.

◆ prepend()

template<class... T>
template<class... U>
constexpr prepend_t< U... > ugmisc::type_list< T >::prepend ( type_list< U... > )
inlinestaticconstexpr

Return an object whose type is the type list with the argument type list's types prepended.

// X, Y, and Z are all ugmisc::type_list<A, B, C, D>.
T t;
P p;
using X = T::prepend_t<A, B>;
using Y = decltype( t.prepend(p) );
using Z = decltype( T::prepend(p) );

This allows type_lists to be used as objects while they are being manipulated, and then the type of the resulting object can be taken, which may be more expressive and legible.

Definition at line 932 of file typelist.hpp.

◆ stride()

template<class... T>
template<class... U>
constexpr stride_method_return< U... > ugmisc::type_list< T >::stride ( U... )
inlinestaticconstexpr

Method which obtains an object whose type is a type_list strided array taken from this type_list.

The arguments can be:

  • A single std::integer_list<> instance (or similar template instance) parameterized with three integral values.
  • Three objects whose types have static constexpr integer values called value.

The three integers are passed to stride_t as template parameters.

Definition at line 1013 of file typelist.hpp.

◆ sublist()

template<class... T>
template<class... U>
constexpr sublist_method_return< U... > ugmisc::type_list< T >::sublist ( U... )
inlinestaticconstexpr

Method which obtains an object whose type is a type_list contiguous subset taken from this type_list.

The arguments can be:

  • A single std::integer_list<> instance (or similar template instance) parameterized with two integral values.
  • Two objects whose types have static constexpr integer values called value.

The two integers are passed to sublist_t as template parameters.

Definition at line 987 of file typelist.hpp.

Member Data Documentation

◆ size

template<class... T>
std::size_t ugmisc::type_list< T >::size = sizeof...(T)
staticconstexpr

Number of types in the list.

Definition at line 880 of file typelist.hpp.


The documentation for this struct was generated from the following file: