00001 /* 00002 TYPELIST.hpp - typelist meta programming facilities 00003 00004 Copyright (C) Lumiera.org 00005 2008, Hermann Vosseler <Ichthyostega@web.de> 00006 00007 This program is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU General Public License as 00009 published by the Free Software Foundation; either version 2 of the 00010 License, or (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program; if not, write to the Free Software 00019 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00020 00021 ==================================================================== 00022 This code is heavily inspired by 00023 The Loki Library (loki-lib/trunk/include/loki/Sequence.h) 00024 Copyright (c) 2001 by Andrei Alexandrescu 00025 Copyright (c) 2005 by Peter Kümmel 00026 This Loki code accompanies the book: 00027 Alexandrescu, Andrei. "Modern C++ Design: Generic Programming 00028 and Design Patterns Applied". 00029 Copyright (c) 2001. Addison-Wesley. ISBN 0201704315 00030 00031 Loki Copyright Notice: 00032 Permission to use, copy, modify, distribute and sell this software for any 00033 purpose is hereby granted without fee, provided that the above copyright 00034 notice appear in all copies and that both that copyright notice and this 00035 permission notice appear in supporting documentation. 00036 The author makes no representations about the suitability of this software 00037 for any purpose. It is provided "as is" without express or implied warranty. 00038 */ 00039 00040 00056 #ifndef LUMIERA_META_TYPELIST_H 00057 #define LUMIERA_META_TYPELIST_H 00058 00059 00060 00061 00062 namespace lumiera 00063 { 00064 namespace typelist 00065 { 00066 00067 class NullType 00068 { 00069 typedef NullType List; 00070 }; 00071 00072 template<class H, class T> 00073 struct Node 00074 { 00075 typedef Node List; 00076 typedef H Head; 00077 typedef T Tail; 00078 }; 00079 00080 template 00081 < class T01=NullType 00082 , class T02=NullType 00083 , class T03=NullType 00084 , class T04=NullType 00085 , class T05=NullType 00086 , class T06=NullType 00087 , class T07=NullType 00088 , class T08=NullType 00089 , class T09=NullType 00090 , class T10=NullType 00091 , class T11=NullType 00092 , class T12=NullType 00093 , class T13=NullType 00094 , class T14=NullType 00095 , class T15=NullType 00096 , class T16=NullType 00097 , class T17=NullType 00098 , class T18=NullType 00099 , class T19=NullType 00100 , class T20=NullType 00101 > 00102 class Types 00103 { 00104 typedef typename Types< T02, T03, T04 00105 , T05, T06, T07, T08 00106 , T09, T10, T11, T12 00107 , T13, T14, T15, T16 00108 , T17, T18, T19, T20>::List ListTail; 00109 public: 00110 typedef Node<T01, ListTail> List; 00111 }; 00112 00113 template<> 00114 struct Types<> 00115 { 00116 typedef NullType List; 00117 }; 00118 00119 00120 typedef Node<NullType,NullType> NodeNull; 00121 00122 00123 } // namespace typelist 00124 00125 } // namespace lumiera 00126 #endif
1.5.6