Lumiera  0.pre.03
»edit your freedom«
typelist.hpp
Go to the documentation of this file.
1 /*
2  TYPELIST.hpp - typelist meta programming facilities
3 
4  Copyright (C)
5  2008, Hermann Vosseler <Ichthyostega@web.de>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 
12 ====================================================================
13 This code is heavily inspired by
14  The Loki Library (loki-lib/trunk/include/loki/Sequence.h)
15  Copyright (c) 2001 by Andrei Alexandrescu
16  Copyright (c) 2005 by Peter Kümmel
17  This Loki code accompanies the book:
18  Alexandrescu, Andrei. "Modern C++ Design: Generic Programming
19  and Design Patterns Applied".
20  Copyright (c) 2001. Addison-Wesley. ISBN 0201704315
21 
22  Loki Copyright Notice:
23  Permission to use, copy, modify, distribute and sell this software for any
24  purpose is hereby granted without fee, provided that the above copyright
25  notice appear in all copies and that both that copyright notice and this
26  permission notice appear in supporting documentation.
27  The author makes no representations about the suitability of this software
28  for any purpose. It is provided "as is" without express or implied warranty.
29 */
30 
31 
68 #ifndef LIB_META_TYPELIST_H
69 #define LIB_META_TYPELIST_H
70 
71 
72 
73 
74 namespace lib {
75 namespace meta {
76 
77  struct NullType
78  {
79  typedef NullType List;
80  };
81 
82  template<class H, class T>
83  struct Node
84  {
85  typedef Node List;
86  typedef H Head;
87  typedef T Tail;
88  };
89 
91 
92 
93 
94  template
95  < class T01=NullType
96  , class T02=NullType
97  , class T03=NullType
98  , class T04=NullType
99  , class T05=NullType
100  , class T06=NullType
101  , class T07=NullType
102  , class T08=NullType
103  , class T09=NullType
104  , class T10=NullType
105  , class T11=NullType
106  , class T12=NullType
107  , class T13=NullType
108  , class T14=NullType
109  , class T15=NullType
110  , class T16=NullType
111  , class T17=NullType
112  , class T18=NullType
113  , class T19=NullType
114  , class T20=NullType
115  >
116  class Types
117  {
118  typedef typename Types< T02, T03, T04
119  , T05, T06, T07, T08
120  , T09, T10, T11, T12
121  , T13, T14, T15, T16
122  , T17, T18, T19, T20>::List ListTail;
123  public:
124  using List = Node<T01, ListTail>;
125  using Seq = Types;
126  };
127 
128  template<>
129  struct Types<>
130  {
131  using List = NullType;
132  using Seq = Types<>;
133  };
134 
135 
136 
137 }} // namespace lib::meta
138 #endif
Implementation namespace for support and library code.