Metaprogramming: Helpers for manipulating lists-of-types.
Sometimes, we use metaprogramming to generate a variation of concrete implementations by combining some basic building blocks. Typically, there is a number of similar, but not suitably related types involved. We want to process those types using a common scheme, without being forced to squeeze all those types into a artificial inheritance relationship. Instead, generating some kind of common factory or adapter, while mixing in pieces of code tailored specifically to the individual types, allows still to build a common processing in such situations.
The facilities in this header provide the basics of simple functional list processing (mostly with tail recursion). Usually, there is one template parameter TYPES, which accepts a type-list. The result of the processing step is then accessible as nested type definition named List. Here, all of the „processing“ to calculate this result is performed by the compiler, as a side-effect set off by the need to compute a requested concrete result type. At run time, in the generated code, typically the resulting classes are empty, maybe just exposing a function outfitted for a specific purpose.
- See also
- generator.hpp
-
typelist-manip-test.cpp
-
TimeControl_test usage example
-
typelist.hpp
Definition in file typelist-manip.hpp.
|
| struct | Pick< TYPES, i > |
| | pick the n-th element from a typelist More...
|
| |
| struct | Pick< Node< TY, TYPES >, 0 > |
| |
| struct | Pick< Node< TY, TYPES >, i > |
| |
| struct | Apply< TY, _TRANS_ > |
| | apply a transformation (template) to each type in the list More...
|
| |
| struct | Apply< Node< TY, TYPES >, _TRANS_ > |
| |
| struct | CondNode< bool, T, TAIL > |
| | conditional node: skip an element based on evaluating a predicate More...
|
| |
| struct | CondNode< true, T, TAIL > |
| |
| struct | Filter< Nil, _P_ > |
| |
| struct | Filter< Node< TY, TYPES >, _P_ > |
| |
| struct | Append< TY1, TY2 > |
| | append (concatenate) lists-of-types More...
|
| |
| struct | Append< Node< TY, TYPES >, TAIL > |
| |
| struct | Append< Nil, Node< TY, TYPES > > |
| |
| struct | Append< Node< TY, TYPES >, Nil > |
| |
| struct | Append< TY1, Nil > |
| |
| struct | Append< Nil, TY2 > |
| |
| struct | Append< Nil, Nil > |
| |
| struct | PickLast< Nil > |
| |
| struct | PickLast< Node< TY, Nil > > |
| |
| struct | PickLast< Node< TY, TYPES > > |
| |
| struct | Splice< Node< B, BS >, OVERLAY, i > |
| |
| struct | Splice< Node< B, BS >, Node< O, OS >, 0 > |
| |
| struct | Splice< Node< B, BS >, Nil, 0 > |
| |
| struct | Splice< Nil, XX, i > |
| |
| struct | Dissect< Node< T, TYPES > > |
| |
| struct | Dissect< Nil > |
| |
| struct | PrefixAll< T, TY > |
| | prefix each of the elements, yielding a list-of lists-of-types More...
|
| |
| struct | PrefixAll< T, Nil > |
| |
| struct | PrefixAll< T, NilNode > |
| |
| struct | PrefixAll< T, Node< TY, TYPES > > |
| |
| struct | Distribute< TY1, TY2 > |
| | build a list-of lists, where each element of the first arg list gets in turn prepended to all elements of the second arg list. More...
|
| |
| struct | Distribute< Nil, TY > |
| |
| struct | Distribute< Node< TY, TYPES >, TAIL > |
| |
| struct | Combine< X, _ENUM_ > |
| | Build all possible combinations, based on a enumeration of the basic cases. More...
|
| |
| struct | Combine< Nil, _ENUM_ > |
| |
| struct | Combine< Node< TY, TYPES >, _ENUM_ > |
| |
| struct | FlagOnOff< F > |
| | enumeration generator for the Combine metafunction, yielding an "on" and "off" case; the latter is represented by a list with a Nil-Entry More...
|
| |
| struct | CombineFlags< FLAGS > |
| | generate all possible on-off combinations of the given flags. More...
|
| |