Lumiera
0.pre.03
»edit your freedom«
|
Go to the source code of this file.
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.
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. | |