Lumiera  0.pre.03
»edit your freedom«
typelist.hpp File Reference

Go to the source code of this file.

Description

A template metaprogramming technique for manipulating collections of types.

Effectively this is a tailored and simplified version of what can be found in the Loki library. We use it in other generic library-style code to generate repetitive code. If you tend to find template metaprogramming (or functional programming in general) offending, please ignore the technical details and just consider the benefit of such an simplification for the client code.

Interface for using this facility is the template Types(.....) for up to 20 Type parameters. To start typelist processing, other templates typically pick up the Types<...>::List type. This allows for LISP-style list processing, with a pattern match on either Node<TY,TYPES> or NullType to terminate recursion. In C++ template metaprogramming, "pattern match" is done by partial template specialisations (the compiler will pick up and thus match the template parameters). A typedef acts like a declaration in normal programming. Because such a "declaration" can't be changed after the fact, effectively this is a flavour of functional programming. Just the "execution environment" is the compiler, during compilation.

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
lib::visitor::Applicable usage example
control::CommandSignature more elaborate usage example (dissecting a functor signature)
TypeList_test
TypeListManip_test

Definition in file typelist.hpp.

Classes

struct  Node< H, T >
 
struct  NullType
 
class  Types< T01, T02, T03, T04, T05, T06, T07, T08, T09, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20 >
 
struct  Types<>
 

Typedefs

typedef Node< NullType, NullType > NodeNull
 

Namespaces

 lib
 Implementation namespace for support and library code.