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) Lumiera.org
5  2008, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 ====================================================================
22 This code is heavily inspired by
23  The Loki Library (loki-lib/trunk/include/loki/Sequence.h)
24  Copyright (c) 2001 by Andrei Alexandrescu
25  Copyright (c) 2005 by Peter Kümmel
26  This Loki code accompanies the book:
27  Alexandrescu, Andrei. "Modern C++ Design: Generic Programming
28  and Design Patterns Applied".
29  Copyright (c) 2001. Addison-Wesley. ISBN 0201704315
30 
31  Loki Copyright Notice:
32  Permission to use, copy, modify, distribute and sell this software for any
33  purpose is hereby granted without fee, provided that the above copyright
34  notice appear in all copies and that both that copyright notice and this
35  permission notice appear in supporting documentation.
36  The author makes no representations about the suitability of this software
37  for any purpose. It is provided "as is" without express or implied warranty.
38 */
39 
40 
77 #ifndef LIB_META_TYPELIST_H
78 #define LIB_META_TYPELIST_H
79 
80 
81 
82 
83 namespace lib {
84 namespace meta {
85 
86  struct NullType
87  {
88  typedef NullType List;
89  };
90 
91  template<class H, class T>
92  struct Node
93  {
94  typedef Node List;
95  typedef H Head;
96  typedef T Tail;
97  };
98 
100 
101 
102 
103  template
104  < class T01=NullType
105  , class T02=NullType
106  , class T03=NullType
107  , class T04=NullType
108  , class T05=NullType
109  , class T06=NullType
110  , class T07=NullType
111  , class T08=NullType
112  , class T09=NullType
113  , class T10=NullType
114  , class T11=NullType
115  , class T12=NullType
116  , class T13=NullType
117  , class T14=NullType
118  , class T15=NullType
119  , class T16=NullType
120  , class T17=NullType
121  , class T18=NullType
122  , class T19=NullType
123  , class T20=NullType
124  >
125  class Types
126  {
127  typedef typename Types< T02, T03, T04
128  , T05, T06, T07, T08
129  , T09, T10, T11, T12
130  , T13, T14, T15, T16
131  , T17, T18, T19, T20>::List ListTail;
132  public:
133  using List = Node<T01, ListTail>;
134  using Seq = Types;
135  };
136 
137  template<>
138  struct Types<>
139  {
140  using List = NullType;
141  using Seq = Types<>;
142  };
143 
144 
145 
146 }} // namespace lib::meta
147 #endif
Implementation namespace for support and library code.