00001 /* Typelist -- lists of types for template programming 00002 Copyright (C) 2002 Aaron Bentley 00003 00004 This program is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 2, or (at your option) 00007 any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software Foundation, 00016 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 00032 namespace meta 00033 { 00035 //typelists 00036 class Nil{}; 00037 00039 template <typename H, typename T=Nil> 00040 class Typelist 00041 { 00042 public: 00044 typedef H Head; 00045 00047 typedef T Tail; 00048 }; 00049 00054 template <typename T1=Nil, typename T2=Nil, typename T3=Nil, 00055 typename T4=Nil, typename T5=Nil, typename T6=Nil, typename T7=Nil> 00056 class List 00057 { 00058 public: 00060 typedef Typelist<T1, typename List<T2, T3, T4, T5, T6, T7>::Ret > Ret; 00061 }; 00062 00067 template<> 00068 class List<Nil, Nil, Nil, Nil, Nil, Nil, Nil> 00069 { 00070 public: 00072 typedef Nil Ret; 00073 }; 00074 }