]> AND Private Git Repository - canny.git/blob - stc/exp/ml_stc_linux_make_v1.0/include/boost/mpl/apply_wrap.hpp
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
6afd6cdbcd9d6cd7a002c84fc990cd6d8dd0818e
[canny.git] / stc / exp / ml_stc_linux_make_v1.0 / include / boost / mpl / apply_wrap.hpp
1 \r
2 #if !defined(BOOST_PP_IS_ITERATING)\r
3 \r
4 ///// header body\r
5 \r
6 #ifndef BOOST_MPL_APPLY_WRAP_HPP_INCLUDED\r
7 #define BOOST_MPL_APPLY_WRAP_HPP_INCLUDED\r
8 \r
9 // Copyright Aleksey Gurtovoy 2000-2008\r
10 //\r
11 // Distributed under the Boost Software License, Version 1.0. \r
12 // (See accompanying file LICENSE_1_0.txt or copy at \r
13 // http://www.boost.org/LICENSE_1_0.txt)\r
14 //\r
15 // See http://www.boost.org/libs/mpl for documentation.\r
16 \r
17 // $Id: apply_wrap.hpp 49272 2008-10-11 06:50:46Z agurtovoy $\r
18 // $Date: 2008-10-11 02:50:46 -0400 (Sat, 11 Oct 2008) $\r
19 // $Revision: 49272 $\r
20 \r
21 #if !defined(BOOST_MPL_PREPROCESSING_MODE)\r
22 #   include <boost/mpl/aux_/arity.hpp>\r
23 #   include <boost/mpl/aux_/has_apply.hpp>\r
24 #   include <boost/mpl/aux_/na.hpp>\r
25 #   include <boost/mpl/aux_/msvc_never_true.hpp>\r
26 #endif\r
27 \r
28 #include <boost/mpl/aux_/config/use_preprocessed.hpp>\r
29 \r
30 #if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \\r
31     && !defined(BOOST_MPL_PREPROCESSING_MODE)\r
32 \r
33 #   define BOOST_MPL_PREPROCESSED_HEADER apply_wrap.hpp\r
34 #   include <boost/mpl/aux_/include_preprocessed.hpp>\r
35 \r
36 #else\r
37 \r
38 #   include <boost/mpl/limits/arity.hpp>\r
39 #   include <boost/mpl/aux_/preprocessor/params.hpp>\r
40 #   include <boost/mpl/aux_/preprocessor/enum.hpp>\r
41 #   include <boost/mpl/aux_/preprocessor/add.hpp>\r
42 #   include <boost/mpl/aux_/config/bcc.hpp>\r
43 #   include <boost/mpl/aux_/config/ctps.hpp>\r
44 #   include <boost/mpl/aux_/config/dtp.hpp>\r
45 #   include <boost/mpl/aux_/config/eti.hpp>\r
46 #   include <boost/mpl/aux_/config/msvc.hpp>\r
47 #   include <boost/mpl/aux_/config/workaround.hpp>\r
48 \r
49 #   include <boost/preprocessor/comma_if.hpp>\r
50 #   include <boost/preprocessor/logical/and.hpp>\r
51 #   include <boost/preprocessor/inc.hpp>\r
52 #   include <boost/preprocessor/iterate.hpp>\r
53 \r
54 \r
55 namespace boost { namespace mpl {\r
56 \r
57 // local macros, #undef-ined at the end of the header\r
58 #   define AUX778076_APPLY_WRAP_PARAMS(n, param) \\r
59     BOOST_MPL_PP_PARAMS(n, param) \\r
60     /**/\r
61 \r
62 #   define AUX778076_APPLY_WRAP_SPEC_PARAMS(n, param) \\r
63     BOOST_MPL_PP_ENUM(BOOST_PP_INC(n), param) \\r
64     /**/\r
65 \r
66 \r
67 #define BOOST_PP_ITERATION_PARAMS_1 \\r
68     (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY, <boost/mpl/apply_wrap.hpp>))\r
69 #include BOOST_PP_ITERATE()\r
70 \r
71 \r
72 #   undef AUX778076_APPLY_WRAP_SPEC_PARAMS\r
73 #   undef AUX778076_APPLY_WRAP_PARAMS\r
74 \r
75 }}\r
76 \r
77 #endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS\r
78 #endif // BOOST_MPL_APPLY_WRAP_HPP_INCLUDED\r
79 \r
80 ///// iteration, depth == 1\r
81 \r
82 // For gcc 4.4 compatability, we must include the\r
83 // BOOST_PP_ITERATION_DEPTH test inside an #else clause.\r
84 #else // BOOST_PP_IS_ITERATING\r
85 #if BOOST_PP_ITERATION_DEPTH() == 1\r
86 \r
87 #   define i_ BOOST_PP_FRAME_ITERATION(1)\r
88 \r
89 #   if BOOST_WORKAROUND(BOOST_MSVC, < 1300)\r
90 // MSVC version\r
91 \r
92 #define AUX778076_MSVC_DTW_NAME BOOST_PP_CAT(msvc_apply,i_)\r
93 #define AUX778076_MSVC_DTW_ORIGINAL_NAME apply\r
94 #define AUX778076_MSVC_DTW_ARITY i_\r
95 #include <boost/mpl/aux_/msvc_dtw.hpp>\r
96 \r
97 template<\r
98       typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T)\r
99     >\r
100 struct BOOST_PP_CAT(apply_wrap,i_)\r
101 {\r
102     // Metafunction forwarding confuses vc6\r
103     typedef typename BOOST_PP_CAT(msvc_apply,i_)<F>::template result_<\r
104           AUX778076_APPLY_WRAP_PARAMS(i_, T)\r
105         >::type type;\r
106 };\r
107 \r
108 #   elif defined(BOOST_MPL_CFG_BROKEN_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES)\r
109 // MWCW/Borland version\r
110 \r
111 template<\r
112       int N, typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T)\r
113     >\r
114 struct BOOST_PP_CAT(apply_wrap_impl,i_);\r
115 \r
116 #define BOOST_PP_ITERATION_PARAMS_2 \\r
117     (3,(0, BOOST_MPL_LIMIT_METAFUNCTION_ARITY - i_, <boost/mpl/apply_wrap.hpp>))\r
118 #include BOOST_PP_ITERATE()\r
119 \r
120 template<\r
121       typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T)\r
122     >\r
123 struct BOOST_PP_CAT(apply_wrap,i_)\r
124     : BOOST_PP_CAT(apply_wrap_impl,i_)<\r
125           ::boost::mpl::aux::arity<F,i_>::value\r
126         , F\r
127         BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, T)\r
128         >::type\r
129 {\r
130 };\r
131 \r
132 #   else\r
133 // ISO98 C++, with minor concession to vc7\r
134 \r
135 template<\r
136       typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T)\r
137 #if i_ == 0\r
138     , typename has_apply_ = typename aux::has_apply<F>::type\r
139 #endif\r
140     >\r
141 struct BOOST_PP_CAT(apply_wrap,i_)\r
142 // metafunction forwarding confuses MSVC 7.0\r
143 #if !BOOST_WORKAROUND(BOOST_MSVC, == 1300)\r
144     : F::template apply< AUX778076_APPLY_WRAP_PARAMS(i_, T) >\r
145 {\r
146 #else\r
147 {    \r
148     typedef typename F::template apply<\r
149          AUX778076_APPLY_WRAP_PARAMS(i_, T)\r
150         >::type type;\r
151 #endif\r
152 };\r
153 \r
154 #if i_ == 0 && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)\r
155 template< typename F >\r
156 struct BOOST_PP_CAT(apply_wrap,i_)<F,true_>\r
157     : F::apply\r
158 {\r
159 };\r
160 #endif\r
161 \r
162 #   endif // workarounds\r
163 \r
164 #if defined(BOOST_MPL_CFG_MSVC_ETI_BUG)\r
165 /// workaround for ETI bug\r
166 template<>\r
167 struct BOOST_PP_CAT(apply_wrap,i_)<AUX778076_APPLY_WRAP_SPEC_PARAMS(i_, int)>\r
168 {\r
169     typedef int type;\r
170 };\r
171 #endif\r
172 \r
173 #   undef i_\r
174 \r
175 ///// iteration, depth == 2\r
176 \r
177 #elif BOOST_PP_ITERATION_DEPTH() == 2\r
178 \r
179 #   define j_ BOOST_PP_FRAME_ITERATION(2)\r
180 \r
181 #if i_ == 0 && j_ == 0 \\r
182     && defined(BOOST_MPL_CFG_BCC590_WORKAROUNDS) \\r
183     && !defined(BOOST_MPL_CFG_NO_HAS_APPLY)\r
184 \r
185 template< typename F, bool F_has_apply >\r
186 struct apply_wrap_impl0_bcb {\r
187     typedef typename F::template apply< na > type;\r
188 };\r
189 \r
190 template< typename F >\r
191 struct apply_wrap_impl0_bcb< F, true > {\r
192     typedef typename F::apply type;\r
193 };\r
194 \r
195 template<\r
196       typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T)\r
197     >\r
198 struct BOOST_PP_CAT(apply_wrap_impl,i_)<\r
199           BOOST_MPL_PP_ADD(i_, j_)\r
200         , F\r
201         BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, T)\r
202         >\r
203 {\r
204     typedef apply_wrap_impl0_bcb< F, aux::has_apply< F >::value >::type type;\r
205 };\r
206 #else\r
207 \r
208 template<\r
209       typename F BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, typename T)\r
210     >\r
211 struct BOOST_PP_CAT(apply_wrap_impl,i_)<\r
212           BOOST_MPL_PP_ADD(i_, j_)\r
213         , F\r
214         BOOST_PP_COMMA_IF(i_) AUX778076_APPLY_WRAP_PARAMS(i_, T)\r
215         >\r
216 {\r
217     typedef typename F::template apply<\r
218           AUX778076_APPLY_WRAP_PARAMS(i_, T)\r
219 #if i_ == 0 && j_ == 0\r
220 /// since the defaults are "lost", we have to pass *something* even for nullary\r
221 /// metafunction classes\r
222         na\r
223 #else\r
224         BOOST_PP_COMMA_IF(BOOST_PP_AND(i_, j_)) BOOST_MPL_PP_ENUM(j_, na)\r
225 #endif\r
226         > type;\r
227 };\r
228 \r
229 #endif\r
230 \r
231 #   undef j_\r
232 \r
233 #endif // BOOST_PP_ITERATION_DEPTH()\r
234 #endif // BOOST_PP_IS_ITERATING\r