1 | |
2 | // Copyright Aleksey Gurtovoy 2000-2004 |
3 | // |
4 | // Distributed under the Boost Software License, Version 1.0. |
5 | // (See accompanying file LICENSE_1_0.txt or copy at |
6 | // http://www.boost.org/LICENSE_1_0.txt) |
7 | // |
8 | // See http://www.boost.org/libs/mpl for documentation. |
9 | |
10 | // $Id$ |
11 | // $Date$ |
12 | // $Revision$ |
13 | |
14 | // NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION! |
15 | |
16 | #if !defined(BOOST_MPL_PREPROCESSING_MODE) |
17 | # include <boost/mpl/bool.hpp> |
18 | # include <boost/mpl/aux_/nested_type_wknd.hpp> |
19 | # include <boost/mpl/aux_/na_spec.hpp> |
20 | # include <boost/mpl/aux_/lambda_support.hpp> |
21 | #endif |
22 | |
23 | #include <boost/mpl/limits/arity.hpp> |
24 | #include <boost/mpl/aux_/preprocessor/params.hpp> |
25 | #include <boost/mpl/aux_/preprocessor/ext_params.hpp> |
26 | #include <boost/mpl/aux_/preprocessor/def_params_tail.hpp> |
27 | #include <boost/mpl/aux_/preprocessor/enum.hpp> |
28 | #include <boost/mpl/aux_/preprocessor/sub.hpp> |
29 | #include <boost/mpl/aux_/config/ctps.hpp> |
30 | #include <boost/mpl/aux_/config/workaround.hpp> |
31 | |
32 | #include <boost/preprocessor/dec.hpp> |
33 | #include <boost/preprocessor/inc.hpp> |
34 | #include <boost/preprocessor/cat.hpp> |
35 | |
36 | namespace boost { namespace mpl { |
37 | |
38 | # define AUX778076_PARAMS(param, sub) \ |
39 | BOOST_MPL_PP_PARAMS( \ |
40 | BOOST_MPL_PP_SUB(BOOST_MPL_LIMIT_METAFUNCTION_ARITY, sub) \ |
41 | , param \ |
42 | ) \ |
43 | /**/ |
44 | |
45 | # define AUX778076_SHIFTED_PARAMS(param, sub) \ |
46 | BOOST_MPL_PP_EXT_PARAMS( \ |
47 | 2, BOOST_MPL_PP_SUB(BOOST_PP_INC(BOOST_MPL_LIMIT_METAFUNCTION_ARITY), sub) \ |
48 | , param \ |
49 | ) \ |
50 | /**/ |
51 | |
52 | # define AUX778076_SPEC_PARAMS(param) \ |
53 | BOOST_MPL_PP_ENUM( \ |
54 | BOOST_PP_DEC(BOOST_MPL_LIMIT_METAFUNCTION_ARITY) \ |
55 | , param \ |
56 | ) \ |
57 | /**/ |
58 | |
59 | namespace aux { |
60 | |
61 | #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) |
62 | |
63 | template< bool C_, AUX778076_PARAMS(typename T, 1) > |
64 | struct BOOST_PP_CAT(AUX778076_OP_NAME,impl) |
65 | : BOOST_PP_CAT(AUX778076_OP_VALUE1,_) |
66 | { |
67 | }; |
68 | |
69 | template< AUX778076_PARAMS(typename T, 1) > |
70 | struct BOOST_PP_CAT(AUX778076_OP_NAME,impl)< AUX778076_OP_VALUE2,AUX778076_PARAMS(T, 1) > |
71 | : BOOST_PP_CAT(AUX778076_OP_NAME,impl)< |
72 | BOOST_MPL_AUX_NESTED_TYPE_WKND(T1)::value |
73 | , AUX778076_SHIFTED_PARAMS(T, 1) |
74 | , BOOST_PP_CAT(AUX778076_OP_VALUE2,_) |
75 | > |
76 | { |
77 | }; |
78 | |
79 | template<> |
80 | struct BOOST_PP_CAT(AUX778076_OP_NAME,impl)< |
81 | AUX778076_OP_VALUE2 |
82 | , AUX778076_SPEC_PARAMS(BOOST_PP_CAT(AUX778076_OP_VALUE2,_)) |
83 | > |
84 | : BOOST_PP_CAT(AUX778076_OP_VALUE2,_) |
85 | { |
86 | }; |
87 | |
88 | #else |
89 | |
90 | template< bool C_ > struct BOOST_PP_CAT(AUX778076_OP_NAME,impl) |
91 | { |
92 | template< AUX778076_PARAMS(typename T, 1) > struct result_ |
93 | : BOOST_PP_CAT(AUX778076_OP_VALUE1,_) |
94 | { |
95 | }; |
96 | }; |
97 | |
98 | template<> struct BOOST_PP_CAT(AUX778076_OP_NAME,impl)<AUX778076_OP_VALUE2> |
99 | { |
100 | template< AUX778076_PARAMS(typename T, 1) > struct result_ |
101 | : BOOST_PP_CAT(AUX778076_OP_NAME,impl)< |
102 | BOOST_MPL_AUX_NESTED_TYPE_WKND(T1)::value |
103 | >::template result_< AUX778076_SHIFTED_PARAMS(T,1),BOOST_PP_CAT(AUX778076_OP_VALUE2,_) > |
104 | { |
105 | }; |
106 | |
107 | #if BOOST_WORKAROUND(BOOST_MSVC, == 1300) |
108 | template<> struct result_<AUX778076_SPEC_PARAMS(BOOST_PP_CAT(AUX778076_OP_VALUE2,_))> |
109 | : BOOST_PP_CAT(AUX778076_OP_VALUE2,_) |
110 | { |
111 | }; |
112 | }; |
113 | #else |
114 | }; |
115 | |
116 | template<> |
117 | struct BOOST_PP_CAT(AUX778076_OP_NAME,impl)<AUX778076_OP_VALUE2> |
118 | ::result_< AUX778076_SPEC_PARAMS(BOOST_PP_CAT(AUX778076_OP_VALUE2,_)) > |
119 | : BOOST_PP_CAT(AUX778076_OP_VALUE2,_) |
120 | { |
121 | }; |
122 | #endif // BOOST_MSVC == 1300 |
123 | |
124 | #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION |
125 | |
126 | } // namespace aux |
127 | |
128 | template< |
129 | typename BOOST_MPL_AUX_NA_PARAM(T1) |
130 | , typename BOOST_MPL_AUX_NA_PARAM(T2) |
131 | BOOST_MPL_PP_DEF_PARAMS_TAIL(2, typename T, BOOST_PP_CAT(AUX778076_OP_VALUE2,_)) |
132 | > |
133 | struct AUX778076_OP_NAME |
134 | #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) |
135 | : aux::BOOST_PP_CAT(AUX778076_OP_NAME,impl)< |
136 | BOOST_MPL_AUX_NESTED_TYPE_WKND(T1)::value |
137 | , AUX778076_SHIFTED_PARAMS(T,0) |
138 | > |
139 | #else |
140 | : aux::BOOST_PP_CAT(AUX778076_OP_NAME,impl)< |
141 | BOOST_MPL_AUX_NESTED_TYPE_WKND(T1)::value |
142 | >::template result_< AUX778076_SHIFTED_PARAMS(T,0) > |
143 | #endif |
144 | { |
145 | BOOST_MPL_AUX_LAMBDA_SUPPORT( |
146 | BOOST_MPL_LIMIT_METAFUNCTION_ARITY |
147 | , AUX778076_OP_NAME |
148 | , (AUX778076_PARAMS(T, 0)) |
149 | ) |
150 | }; |
151 | |
152 | BOOST_MPL_AUX_NA_SPEC2( |
153 | 2 |
154 | , BOOST_MPL_LIMIT_METAFUNCTION_ARITY |
155 | , AUX778076_OP_NAME |
156 | ) |
157 | |
158 | }} |
159 | |
160 | #undef AUX778076_SPEC_PARAMS |
161 | #undef AUX778076_SHIFTED_PARAMS |
162 | #undef AUX778076_PARAMS |
163 | #undef AUX778076_OP_NAME |
164 | #undef AUX778076_OP_VALUE1 |
165 | #undef AUX778076_OP_VALUE2 |
166 | |