00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #ifndef LASS_GUARDIAN_OF_INCLUSION_TYPE_LIST_H
00044 #define LASS_GUARDIAN_OF_INCLUSION_TYPE_LIST_H
00045
00046 #include "meta_common.h"
00047 #include "null_type.h"
00048
00049 namespace lass
00050 {
00051 namespace meta
00052 {
00053
00054 template <typename Head, typename Tail>
00055 struct TypeList
00056 {
00057 typedef Head THead;
00058 typedef Tail TTail;
00059 typedef TypeList<Head, Tail> Type;
00060 };
00061
00062 namespace type_list
00063 {
00064
00065 template
00066 <
00067 typename T1 = NullType, typename T2 = NullType, typename T3 = NullType, typename T4 = NullType,
00068 typename T5 = NullType, typename T6 = NullType, typename T7 = NullType, typename T8 = NullType,
00069 typename T9 = NullType, typename T10 = NullType, typename T11 = NullType, typename T12 = NullType,
00070 typename T13 = NullType, typename T14 = NullType, typename T15 = NullType, typename T16 = NullType
00071 >
00072 struct Make
00073 {
00074 typedef TypeList
00075 <
00076 T1,
00077 typename Make<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>::Type
00078 > Type;
00079 };
00080
00081 template<>
00082 struct Make<>
00083 {
00084 typedef NullType Type;
00085 };
00086
00087
00088
00089 template <typename Ts, typename X> struct Contains;
00090
00091 template <typename H, typename Ts, typename X>
00092 struct Contains<TypeList<H, Ts>, X>: public Contains<Ts, X> {};
00093
00094 template <typename Ts, typename X>
00095 struct Contains<TypeList<X, Ts>, X>: public True {};
00096
00097 template <typename X>
00098 struct Contains<NullType, X>: public False {};
00099
00100
00101
00102 template <typename Ts, size_t i> struct At;
00103
00104 template <typename H, typename Ts, size_t i>
00105 struct At<TypeList<H, Ts>, i>: public At<Ts, i - 1> {};
00106
00107 template <typename H, typename Ts>
00108 struct At<TypeList<H, Ts>, 0>
00109 {
00110 typedef H Type;
00111 };
00112
00113
00114
00115 template <typename Ts, typename X> struct PushBack;
00116
00117 template <typename H, typename Ts, typename X>
00118 struct PushBack<TypeList<H, Ts>, X>
00119 {
00120 typedef TypeList<H, typename PushBack<Ts, X>::Type> Type;
00121 };
00122
00123 template <typename X>
00124 struct PushBack<NullType, X>
00125 {
00126 typedef TypeList<X, NullType> Type;
00127 };
00128
00129
00130
00131 template <typename Ts, typename Tail = NullType> struct Reverse;
00132
00133 template <typename H, typename Ts, typename Tail>
00134 struct Reverse<TypeList<H, Ts>, Tail>: public Reverse< Ts, TypeList<H, Tail> > {};
00135
00136 template <typename Tail>
00137 struct Reverse<NullType, Tail>
00138 {
00139 typedef Tail Type;
00140 };
00141
00142
00143 }
00144 }
00145 }
00146
00147 #endif
00148
00149