Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

type_lists.h

Go to the documentation of this file.
00001 /*
00002 *
00003 * templog library
00004 *
00005 * Copyright Hendrik Schober
00006 * Distributed under the Boost Software License, Version 1.0.
00007 *    (See accompanying file LICENSE_1_0.txt or copy at
00008 *     http://www.boost.org/LICENSE_1_0.txt)
00009 *
00010 * see http://templog.sourceforge.net/ for more info
00011 *
00012 */
00013 
00025 #if !defined(TEMPLOG_TYPELISTS_H)
00026 #define TEMPLOG_TYPELISTS_H
00027 
00028 /******************************************************************************/
00029 #include "config.h"
00030 #include "templ_meta.h"
00031 
00032 /******************************************************************************/
00033 
00034 namespace templog {
00035 
00036     namespace templ_meta {
00037 
00041         template< typename Head_, class Tail_ >
00042         struct type_list {
00043             typedef Head_                                   head_type;
00044             typedef Tail_                                   tail_type;
00045         };
00046 
00050         template< typename T01_ = nil, typename T02_ = nil, typename T03_ = nil
00051                 , typename T04_ = nil, typename T05_ = nil, typename T06_ = nil
00052                 , typename T07_ = nil, typename T08_ = nil, typename T09_ = nil >
00053         struct type_list_generator {
00054         private:
00055             template< class TypeList_ > 
00056             struct nil_remover_;
00057             template< typename Head_, class Tail_ >
00058             struct nil_remover_< type_list<Head_,Tail_> > {
00059                 typedef type_list<Head_,typename nil_remover_<Tail_>::result_type>
00060                                                               result_type;
00061             };
00062             template< typename Head_ >
00063             struct nil_remover_< type_list<Head_,nil> > {
00064                 typedef type_list<Head_,nil>                  result_type;
00065             };
00066             typedef type_list< T01_
00067                   , type_list< T02_
00068                   , type_list< T03_
00069                   , type_list< T04_
00070                   , type_list< T05_
00071                   , type_list< T06_
00072                   , type_list< T07_
00073                   , type_list< T08_
00074                   , type_list< T09_, nil > > > > > > > > >  long_list_type_;
00075         public:
00076             typedef typename nil_remover_<long_list_type_>::result_type
00077                                                             result_type;
00078         };
00079 
00083         template< int Invalid_ = 0
00084                 , int I01_ = Invalid_, int I02_ = Invalid_, int I03_ = Invalid_
00085                 , int I04_ = Invalid_, int I05_ = Invalid_, int I06_ = Invalid_
00086                 , int I07_ = Invalid_, int I08_ = Invalid_, int I09_ = Invalid_ >
00087         struct int_type_list_generator 
00088             : public type_list_generator< int2type<I01_>, int2type<I02_>, int2type<I03_>
00089                                         , int2type<I04_>, int2type<I05_>, int2type<I06_>
00090                                         , int2type<I07_>, int2type<I08_>, int2type<I09_> > 
00091         {};
00092 
00097         template< class TypeList_, typename T >
00098         struct type_list_includes;
00099 
00100         template< typename T >
00101         struct type_list_includes< nil, T >
00102             : public boolean<false> {};
00103 
00104         template< class Tail_, typename T >
00105         struct type_list_includes< type_list<T,Tail_>, T >
00106             : public boolean<true> {};
00107 
00108         template< typename Head_, class Tail_, typename T >
00109         struct type_list_includes< type_list<Head_,Tail_>, T >
00110             : public type_list_includes<Tail_,T> {};
00111 
00116         template< class TypeList_, int I >
00117         struct int_type_list_includes : public type_list_includes< TypeList_, int2type<I> > {};
00118 
00119     }
00120 
00121 }
00122 
00123 /******************************************************************************/
00124 
00125 #endif //defined(TEMPLOG_TYPELISTS_H)
00126 
00127 /******************************************************************************/
00128 /* EOF */

Generated on Sun Jan 11 15:57:20 2009 for templog library by  doxygen 1.4.2