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
00046 #ifndef TYPELIST_HPP
00047 #define TYPELIST_HPP
00048
00049 #ifdef _MSC_VER
00050 #pragma warning(disable: 4503)
00051 #endif // #ifdef _MSC_VER
00052
00053 #include <ext/pb_assoc/detail/type_utils.hpp>
00054
00055 namespace pb_assoc
00056 {
00057
00058 namespace detail
00059 {
00060
00061 struct null_type
00062 { };
00063
00064 template<typename Hd, typename Tl>
00065 struct typelist_chain
00066 {
00067 typedef Hd head;
00068
00069 typedef Tl tail;
00070 };
00071
00072 template<class Root>
00073 struct typelist
00074 {
00075 typedef Root root;
00076 };
00077
00078 #define PB_ASSOC_TYPELIST_CHAIN1(X0) pb_assoc::detail::typelist_chain<X0, pb_assoc::detail::null_type>
00079 #define PB_ASSOC_TYPELIST_CHAIN2(X0, X1) pb_assoc::detail::typelist_chain<X0, PB_ASSOC_TYPELIST_CHAIN1(X1) >
00080 #define PB_ASSOC_TYPELIST_CHAIN3(X0, X1, X2) pb_assoc::detail::typelist_chain<X0, PB_ASSOC_TYPELIST_CHAIN2(X1, X2) >
00081 #define PB_ASSOC_TYPELIST_CHAIN4(X0, X1, X2, X3) pb_assoc::detail::typelist_chain<X0, PB_ASSOC_TYPELIST_CHAIN3(X1, X2, X3) >
00082 #define PB_ASSOC_TYPELIST_CHAIN5(X0, X1, X2, X3, X4) pb_assoc::detail::typelist_chain<X0, PB_ASSOC_TYPELIST_CHAIN4(X1, X2, X3, X4) >
00083 #define PB_ASSOC_TYPELIST_CHAIN6(X0, X1, X2, X3, X4, X5) pb_assoc::detail::typelist_chain<X0, PB_ASSOC_TYPELIST_CHAIN5(X1, X2, X3, X4, X5) >
00084 #define PB_ASSOC_TYPELIST_CHAIN7(X0, X1, X2, X3, X4, X5, X6) pb_assoc::detail::typelist_chain<X0, PB_ASSOC_TYPELIST_CHAIN6(X1, X2, X3, X4, X5, X6) >
00085 #define PB_ASSOC_TYPELIST_CHAIN8(X0, X1, X2, X3, X4, X5, X6, X7) pb_assoc::detail::typelist_chain<X0, PB_ASSOC_TYPELIST_CHAIN7(X1, X2, X3, X4, X5, X6, X7) >
00086 #define PB_ASSOC_TYPELIST_CHAIN9(X0, X1, X2, X3, X4, X5, X6, X7, X8) pb_assoc::detail::typelist_chain<X0, PB_ASSOC_TYPELIST_CHAIN8(X1, X2, X3, X4, X5, X6, X7, X8) >
00087 #define PB_ASSOC_TYPELIST_CHAIN10(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9) pb_assoc::detail::typelist_chain<X0, PB_ASSOC_TYPELIST_CHAIN9(X1, X2, X3, X4, X5, X6, X7, X8, X9) >
00088 #define PB_ASSOC_TYPELIST_CHAIN11(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) pb_assoc::detail::typelist_chain<X0, PB_ASSOC_TYPELIST_CHAIN10(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10) >
00089 #define PB_ASSOC_TYPELIST_CHAIN12(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) pb_assoc::detail::typelist_chain<X0, PB_ASSOC_TYPELIST_CHAIN11(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11) >
00090 #define PB_ASSOC_TYPELIST_CHAIN13(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) pb_assoc::detail::typelist_chain<X0, PB_ASSOC_TYPELIST_CHAIN12(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12) >
00091 #define PB_ASSOC_TYPELIST_CHAIN14(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) pb_assoc::detail::typelist_chain<X0, PB_ASSOC_TYPELIST_CHAIN13(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13) >
00092 #define PB_ASSOC_TYPELIST_CHAIN15(X0, X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) pb_assoc::detail::typelist_chain<X0, PB_ASSOC_TYPELIST_CHAIN14(X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14) >
00093
00094 #include <ext/pb_assoc/detail/typelist/typelist_apply.hpp>
00095
00096 template<class Fn, class Typelist>
00097 void
00098 typelist_apply(Fn& r_fn, Typelist )
00099 {
00100 detail::apply_<
00101 Fn,
00102 typename Typelist::root>
00103 a;
00104
00105 a(r_fn);
00106 }
00107
00108 #include <ext/pb_assoc/detail/typelist/typelist_append.hpp>
00109
00110 template<class Typelist0, class Typelist1>
00111 struct typelist_append
00112 {
00113 private:
00114 typedef
00115 typename detail::typelist_append_<
00116 typename Typelist0::root,
00117 typename Typelist1::root>::type
00118 res_hd;
00119
00120 public:
00121 typedef typelist< res_hd> type;
00122 };
00123
00124 #include <ext/pb_assoc/detail/typelist/typelist_typelist_append.hpp>
00125
00126 template<class Typelist_Typelist>
00127 struct typelist_typelist_append
00128 {
00129 private:
00130 typedef
00131 typename detail::typelist_typelist_append_<
00132 typename Typelist_Typelist::root>::type
00133 res_hd;
00134
00135 public:
00136 typedef typelist< res_hd> type;
00137 };
00138
00139 #include <ext/pb_assoc/detail/typelist/typelist_contains.hpp>
00140
00141 template<class Typelist, class T>
00142 struct typelist_contains
00143 {
00144 enum
00145 {
00146 value =
00147 detail::typelist_contains_<
00148 typename Typelist::root,
00149 T>::value
00150 };
00151 };
00152
00153 #include <ext/pb_assoc/detail/typelist/typelist_filter.hpp>
00154
00155 template<class Typelist, template<typename T>
00156 class Pred>
00157 struct typelist_filter
00158 {
00159 private:
00160 typedef
00161 typename detail::typelist_chain_filter_<
00162 typename Typelist::root,
00163 Pred>::type
00164 root_type;
00165
00166 public:
00167 typedef typelist< root_type> type;
00168 };
00169
00170 #include <ext/pb_assoc/detail/typelist/typelist_at_index.hpp>
00171
00172 template<class Typelist, int i>
00173 struct typelist_at_index
00174 {
00175 typedef
00176 typename detail::typelist_chain_at_index_<
00177 typename Typelist::root,
00178 i>::type
00179 type;
00180 };
00181
00182 #include <ext/pb_assoc/detail/typelist/typelist_transform.hpp>
00183
00184 template<class Typelist, template<class T>
00185 class Transform>
00186 struct typelist_transform
00187 {
00188 private:
00189 typedef
00190 typename detail::typelist_chain_transform_<
00191 typename Typelist::root,
00192 Transform>::type
00193 root_type;
00194
00195 public:
00196 typedef typelist< root_type> type;
00197 };
00198
00199 #undef PB_ASSOC_TYPELIST_CHAIN1
00200 #undef PB_ASSOC_TYPELIST_CHAIN2
00201 #undef PB_ASSOC_TYPELIST_CHAIN3
00202 #undef PB_ASSOC_TYPELIST_CHAIN4
00203 #undef PB_ASSOC_TYPELIST_CHAIN5
00204 #undef PB_ASSOC_TYPELIST_CHAIN6
00205 #undef PB_ASSOC_TYPELIST_CHAIN7
00206 #undef PB_ASSOC_TYPELIST_CHAIN8
00207 #undef PB_ASSOC_TYPELIST_CHAIN9
00208 #undef PB_ASSOC_TYPELIST_CHAIN10
00209 #undef PB_ASSOC_TYPELIST_CHAIN11
00210 #undef PB_ASSOC_TYPELIST_CHAIN12
00211 #undef PB_ASSOC_TYPELIST_CHAIN13
00212 #undef PB_ASSOC_TYPELIST_CHAIN14
00213 #undef PB_ASSOC_TYPELIST_CHAIN15
00214
00215 }
00216
00217 }
00218
00219 #endif // #ifndef TYPELIST_HPP
00220