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

tuples.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_TUPLES_H)
00026 #define TEMPLOG_TUPLES_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 tuple {
00043             typedef Head_                                   head_type;
00044             typedef Tail_                                   tail_type;
00045 
00046             head_type                           head;
00047             tail_type                           tail;
00048 
00049             tuple( const head_type& h
00050                  , const tail_type& t )                   : head(h), tail(t) {}
00051         };
00052 
00056         template< typename T01_ = nil, typename T02_ = nil, typename T03_ = nil
00057                 , typename T04_ = nil, typename T05_ = nil, typename T06_ = nil
00058                 , typename T07_ = nil, typename T08_ = nil, typename T09_ = nil >
00059         struct tuple_generator {
00060         private:
00061             template< class Tuple_ > 
00062             struct nil_remover_;
00063             template< typename Head_, class Tail_ >
00064             struct nil_remover_< tuple<Head_,Tail_> > {
00065                 typedef tuple<Head_,typename nil_remover_<Tail_>::result_type>
00066                                                               result_type;
00067             };
00068             template< typename Head_ >
00069             struct nil_remover_< tuple<Head_,nil> > {
00070                 typedef type_list<Head_,nil>                  result_type;
00071             };
00072             typedef tuple< T01_
00073                   , tuple< T02_
00074                   , tuple< T03_
00075                   , tuple< T04_
00076                   , tuple< T05_
00077                   , tuple< T06_
00078                   , tuple< T07_
00079                   , tuple< T08_
00080                   , tuple< T09_, nil > > > > > > > > >      long_list_type_;
00081         public:
00082             typedef typename nil_remover_<long_list_type_>::result_type
00083                                                             result_type;
00084         };
00085 
00090         template< class Tuple_, typename T >
00091         struct tuple_includes;
00092 
00093         template< typename T >
00094         struct tuple_includes< nil, T >
00095             : public boolean<false> {};
00096 
00097         template< class Tail_, typename T >
00098         struct tuple_includes< tuple<T,Tail_>, T >
00099             : public boolean<true> {};
00100 
00101         template< typename Head_, class Tail_, typename T >
00102         struct tuple_includes< tuple<Head_,Tail_>, T >
00103             : public tuple_includes<Tail_,T> {};
00104 
00105     }
00106 
00107 }
00108 
00109 /******************************************************************************/
00110 
00111 #endif //defined(TEMPLOG_TUPLES_H)
00112 
00113 /******************************************************************************/
00114 /* EOF */

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