Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
typelist-manip.hpp File Reference

Metaprogramming: Helpers for manipulating lists-of-types. More...

Go to the source code of this file.

Description

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.

Remarks
historically, these functions were developed for the first draft of the render engine, which (for other reasons) did not come to fruition. Over time, some of these functions were used on and off for various purposes; and since (as of 2025) Loki-style type lists are considered an integral part of the Lumiera framework, useful meta-functions are added and documented here, even when not currently in use.
See also
generator.hpp
typelist-manip-test.cpp
TimeControl_test usage example
typelist.hpp

Definition in file typelist-manip.hpp.

#include "lib/meta/typelist.hpp"
#include <sys/types.h>

Namespaces

namespace  lib
 Implementation namespace for support and library code.
 
namespace  lib::meta
 

Typedefs

template<class LI , uint l>
using Prefix = Splice< LI, Nil, l >::Front
 extract prefix of given length
 
template<class LI , uint p>
using Suffix = Splice< LI, Nil, p >::Back
 extract suffix starting at given pos
 

Classes

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...
 

Class Documentation

◆ lib::meta::Pick

struct lib::meta::Pick
Class Members
typedef Nil Type
+ Collaboration diagram for Pick< TYPES, i >:

◆ lib::meta::Pick< Node< TY, TYPES >, 0 >

struct lib::meta::Pick< Node< TY, TYPES >, 0 >
Class Members
typedef TY Type
+ Collaboration diagram for Pick< Node< TY, TYPES >, 0 >:

◆ lib::meta::Pick< Node< TY, TYPES >, i >

struct lib::meta::Pick< Node< TY, TYPES >, i >
Class Members
typedef Type Type
+ Collaboration diagram for Pick< Node< TY, TYPES >, i >:

◆ lib::meta::Apply

struct lib::meta::Apply
Class Members
typedef TY List
+ Collaboration diagram for Apply< TY, _TRANS_ >:

◆ lib::meta::Apply< Node< TY, TYPES >, _TRANS_ >

struct lib::meta::Apply< Node< TY, TYPES >, _TRANS_ >
Class Members
typedef Type, typename List > List
+ Collaboration diagram for Apply< Node< TY, TYPES >, _TRANS_ >:

◆ lib::meta::CondNode

struct lib::meta::CondNode
Class Members
typedef TAIL Next
+ Collaboration diagram for CondNode< bool, T, TAIL >:

◆ lib::meta::CondNode< true, T, TAIL >

struct lib::meta::CondNode< true, T, TAIL >
Class Members
typedef Node< T, TAIL > Next
+ Collaboration diagram for CondNode< true, T, TAIL >:

◆ lib::meta::Filter< Nil, _P_ >

struct lib::meta::Filter< Nil, _P_ >
Class Members
typedef Nil List
+ Collaboration diagram for Filter< Nil, _P_ >:

◆ lib::meta::Filter< Node< TY, TYPES >, _P_ >

struct lib::meta::Filter< Node< TY, TYPES >, _P_ >
Class Members
typedef value, TY, typename List >::Next List
+ Collaboration diagram for Filter< Node< TY, TYPES >, _P_ >:

◆ lib::meta::Append

struct lib::meta::Append
Class Members
typedef List > List
+ Collaboration diagram for Append< TY1, TY2 >:

◆ lib::meta::Append< Node< TY, TYPES >, TAIL >

struct lib::meta::Append< Node< TY, TYPES >, TAIL >
Class Members
typedef List > List
+ Collaboration diagram for Append< Node< TY, TYPES >, TAIL >:

◆ lib::meta::Append< Nil, Node< TY, TYPES > >

struct lib::meta::Append< Nil, Node< TY, TYPES > >
Class Members
typedef Node< TY, TYPES > List
+ Collaboration diagram for Append< Nil, Node< TY, TYPES > >:

◆ lib::meta::Append< Node< TY, TYPES >, Nil >

struct lib::meta::Append< Node< TY, TYPES >, Nil >
Class Members
typedef Node< TY, TYPES > List
+ Collaboration diagram for Append< Node< TY, TYPES >, Nil >:

◆ lib::meta::Append< TY1, Nil >

struct lib::meta::Append< TY1, Nil >
Class Members
typedef Node< TY1, Nil > List
+ Collaboration diagram for Append< TY1, Nil >:

◆ lib::meta::Append< Nil, TY2 >

struct lib::meta::Append< Nil, TY2 >
Class Members
typedef Node< TY2, Nil > List
+ Collaboration diagram for Append< Nil, TY2 >:

◆ lib::meta::Append< Nil, Nil >

struct lib::meta::Append< Nil, Nil >
Class Members
typedef Nil List
+ Collaboration diagram for Append< Nil, Nil >:

◆ lib::meta::PickLast< Nil >

struct lib::meta::PickLast< Nil >
Class Members
typedef Nil Type
typedef Nil List
+ Collaboration diagram for PickLast< Nil >:

◆ lib::meta::PickLast< Node< TY, Nil > >

struct lib::meta::PickLast< Node< TY, Nil > >
Class Members
typedef TY Type
typedef Nil List
+ Collaboration diagram for PickLast< Node< TY, Nil > >:

◆ lib::meta::PickLast< Node< TY, TYPES > >

struct lib::meta::PickLast< Node< TY, TYPES > >
Class Members
typedef Type Type
typedef List >::List List
+ Collaboration diagram for PickLast< Node< TY, TYPES > >:

◆ lib::meta::Splice< Node< B, BS >, OVERLAY, i >

struct lib::meta::Splice< Node< B, BS >, OVERLAY, i >
Class Members
typedef List > List
typedef Front > Front
typedef typename Back Back
+ Collaboration diagram for Splice< Node< B, BS >, OVERLAY, i >:

◆ lib::meta::Splice< Node< B, BS >, Node< O, OS >, 0 >

struct lib::meta::Splice< Node< B, BS >, Node< O, OS >, 0 >
Class Members
typedef List > List
typedef Nil Front
typedef typename Back Back
+ Collaboration diagram for Splice< Node< B, BS >, Node< O, OS >, 0 >:

◆ lib::meta::Splice< Node< B, BS >, Nil, 0 >

struct lib::meta::Splice< Node< B, BS >, Nil, 0 >
Class Members
typedef Node< B, BS > List
typedef Nil Front
typedef Node< B, BS > Back
+ Collaboration diagram for Splice< Node< B, BS >, Nil, 0 >:

◆ lib::meta::Splice< Nil, XX, i >

struct lib::meta::Splice< Nil, XX, i >
Class Members
typedef Nil List
typedef Nil Front
typedef Nil Back
+ Collaboration diagram for Splice< Nil, XX, i >:

◆ lib::meta::Dissect< Node< T, TYPES > >

struct lib::meta::Dissect< Node< T, TYPES > >
Class Members
typedef Node< T, TYPES > List the complete list
typedef T Head first element
typedef Node< T, Nil > First a list containing the first element
typedef TYPES Tail remainder of the list starting with the second elm.
typedef List Prefix all of the list, up to but excluding the last element
typedef Type End the last element
typedef Node< End, Nil > Last a list containing the last element
+ Collaboration diagram for Dissect< Node< T, TYPES > >:

◆ lib::meta::Dissect< Nil >

struct lib::meta::Dissect< Nil >
Class Members
typedef Nil List
typedef Nil Head
typedef Nil First
typedef Nil Tail
typedef Nil Prefix
typedef Nil End
typedef Nil Last
+ Collaboration diagram for Dissect< Nil >:

◆ lib::meta::PrefixAll

struct lib::meta::PrefixAll
Class Members
typedef List, Nil > List
+ Collaboration diagram for PrefixAll< T, TY >:

◆ lib::meta::PrefixAll< T, Nil >

struct lib::meta::PrefixAll< T, Nil >
Class Members
typedef Nil List
+ Collaboration diagram for PrefixAll< T, Nil >:

◆ lib::meta::PrefixAll< T, NilNode >

struct lib::meta::PrefixAll< T, NilNode >
Class Members
typedef List, Nil > List
+ Collaboration diagram for PrefixAll< T, NilNode >:

◆ lib::meta::PrefixAll< T, Node< TY, TYPES > >

struct lib::meta::PrefixAll< T, Node< TY, TYPES > >
Class Members
typedef List, typename List > List
+ Collaboration diagram for PrefixAll< T, Node< TY, TYPES > >:

◆ lib::meta::Distribute

struct lib::meta::Distribute
Class Members
typedef List List
+ Inheritance diagram for Distribute< TY1, TY2 >:
+ Collaboration diagram for Distribute< TY1, TY2 >:

◆ lib::meta::Distribute< Nil, TY >

struct lib::meta::Distribute< Nil, TY >
Class Members
typedef Nil List
+ Collaboration diagram for Distribute< Nil, TY >:

◆ lib::meta::Distribute< Node< TY, TYPES >, TAIL >

struct lib::meta::Distribute< Node< TY, TYPES >, TAIL >
Class Members
typedef List, typename List >::List List
+ Collaboration diagram for Distribute< Node< TY, TYPES >, TAIL >:

◆ lib::meta::Combine

struct lib::meta::Combine
Class Members
typedef List, NilNode >::List List
+ Collaboration diagram for Combine< X, _ENUM_ >:

◆ lib::meta::Combine< Nil, _ENUM_ >

struct lib::meta::Combine< Nil, _ENUM_ >
Class Members
typedef NilNode List
+ Collaboration diagram for Combine< Nil, _ENUM_ >:

◆ lib::meta::Combine< Node< TY, TYPES >, _ENUM_ >

struct lib::meta::Combine< Node< TY, TYPES >, _ENUM_ >
Class Members
typedef List, typename List >::List List
+ Collaboration diagram for Combine< Node< TY, TYPES >, _ENUM_ >:

◆ lib::meta::FlagOnOff

struct lib::meta::FlagOnOff
Class Members
typedef Node< F, NilNode > List
+ Collaboration diagram for FlagOnOff< F >:

◆ lib::meta::CombineFlags

struct lib::meta::CombineFlags
Class Members
typedef List List
+ Collaboration diagram for CombineFlags< FLAGS >: