Lumiera  0.pre.03
»edit your freedom«
typeseq-util.hpp File Reference

Go to the source code of this file.

Description

Some basic facilities for manipulating type sequences.

While typelist.hpp provides the foundation of metaprogramming with typelists, manipulating the type sequences themselves (i.e. Types<T1,T2,...> instances) requires some additional helper templates supplemented here.

  • prepending to a type sequence
  • dissecting a type sequence
  • shifting a type sequence
  • re-generating a type sequence from a typelist.
Warning
the metaprogramming part of Lumiera to deal with type sequences is in a state of transition, since C++11 now offers direct language support for processing of flexible template parameter sequences ("parameter packs"). It is planned to regroup and simplify our homemade type sequence framework to rely on variadic templates and integrate better with std::tuple. It is clear that we will retain some parts of our own framework, since programming with Loki-style typelists is way more obvious and straight forward than handling of template parameter packs, since the latter can only be rebound through pattern matching.
Todo:
transition lib::meta::Types to variadic parameters /////////////////////////////////TICKET #987
See also
typeseq-manip-test.cpp
typelist.hpp
typelist-util.hpp
tuple-helper.hpp
function.hpp
generator.hpp

Definition in file typeseq-util.hpp.

Classes

struct  Pick< Types< TYPES... >, i >
 specialisation: pick n-th element from a type sequence More...
 
struct  Prepend< T, TYPES >
 Helper: prepend a type to an existing type sequence, thus shifting all elements within the sequence to the right, eventually dropping the last element. More...
 
struct  Prepend< T01, Types< T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, IGN > >
 
class  Shifted< TYPES, i >
 Helper: generate a type sequence left shifted by i steps, filling in NullType at the end. More...
 
struct  Shifted< TYPES, 0 >
 
struct  Split< TYPES >
 Helper: separate parts of a type sequence. More...
 
struct  Split< Types< T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20 > >
 
struct  Types< Node< H, T > >
 Additional specialisation of the basic type sequence type, allowing to re-create a (flat) type sequence from a typelist. More...
 

Functions

template<class X >
constexpr size_t indexOfType ()
 Find the index of the first incidence of a type in a type-sequence. More...
 
template<class X , class T , class... TYPES>
constexpr size_t indexOfType ()
 

Namespaces

 lib
 Implementation namespace for support and library code.
 

Function Documentation

◆ indexOfType()

constexpr size_t lib::meta::indexOfType ( )

Find the index of the first incidence of a type in a type-sequence.

Note
static assertion if the type is not in the type sequence
See also
https://stackoverflow.com/a/60868425/444796
Examples:
/Werk/devel/lumi/src/lib/hetero-data.hpp.

Definition at line 66 of file typeseq-util.hpp.