Chris@16
|
1
|
Chris@16
|
2 #ifndef BOOST_MPL_ASSERT_HPP_INCLUDED
|
Chris@16
|
3 #define BOOST_MPL_ASSERT_HPP_INCLUDED
|
Chris@16
|
4
|
Chris@16
|
5 // Copyright Aleksey Gurtovoy 2000-2006
|
Chris@16
|
6 //
|
Chris@16
|
7 // Distributed under the Boost Software License, Version 1.0.
|
Chris@16
|
8 // (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
9 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
10 //
|
Chris@16
|
11 // See http://www.boost.org/libs/mpl for documentation.
|
Chris@16
|
12
|
Chris@101
|
13 // $Id$
|
Chris@101
|
14 // $Date$
|
Chris@101
|
15 // $Revision$
|
Chris@16
|
16
|
Chris@16
|
17 #include <boost/mpl/not.hpp>
|
Chris@16
|
18 #include <boost/mpl/aux_/value_wknd.hpp>
|
Chris@16
|
19 #include <boost/mpl/aux_/nested_type_wknd.hpp>
|
Chris@16
|
20 #include <boost/mpl/aux_/yes_no.hpp>
|
Chris@16
|
21 #include <boost/mpl/aux_/na.hpp>
|
Chris@16
|
22 #include <boost/mpl/aux_/adl_barrier.hpp>
|
Chris@16
|
23
|
Chris@16
|
24 #include <boost/mpl/aux_/config/nttp.hpp>
|
Chris@16
|
25 #include <boost/mpl/aux_/config/dtp.hpp>
|
Chris@16
|
26 #include <boost/mpl/aux_/config/gcc.hpp>
|
Chris@16
|
27 #include <boost/mpl/aux_/config/msvc.hpp>
|
Chris@101
|
28 #include <boost/mpl/aux_/config/gpu.hpp>
|
Chris@16
|
29 #include <boost/mpl/aux_/config/static_constant.hpp>
|
Chris@16
|
30 #include <boost/mpl/aux_/config/pp_counter.hpp>
|
Chris@16
|
31 #include <boost/mpl/aux_/config/workaround.hpp>
|
Chris@16
|
32
|
Chris@16
|
33 #include <boost/preprocessor/cat.hpp>
|
Chris@16
|
34
|
Chris@16
|
35 #include <boost/config.hpp> // make sure 'size_t' is placed into 'std'
|
Chris@16
|
36 #include <cstddef>
|
Chris@16
|
37
|
Chris@16
|
38 #if BOOST_WORKAROUND(BOOST_MSVC, == 1700)
|
Chris@16
|
39 #include <boost/mpl/if.hpp>
|
Chris@16
|
40 #endif
|
Chris@16
|
41
|
Chris@16
|
42 #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) \
|
Chris@16
|
43 || (BOOST_MPL_CFG_GCC != 0) \
|
Chris@16
|
44 || BOOST_WORKAROUND(__IBMCPP__, <= 600)
|
Chris@16
|
45 # define BOOST_MPL_CFG_ASSERT_USE_RELATION_NAMES
|
Chris@16
|
46 #endif
|
Chris@16
|
47
|
Chris@16
|
48 #if BOOST_WORKAROUND(__MWERKS__, < 0x3202) \
|
Chris@16
|
49 || BOOST_WORKAROUND(__EDG_VERSION__, <= 238) \
|
Chris@16
|
50 || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) \
|
Chris@16
|
51 || BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x840))
|
Chris@16
|
52 # define BOOST_MPL_CFG_ASSERT_BROKEN_POINTER_TO_POINTER_TO_MEMBER
|
Chris@16
|
53 #endif
|
Chris@16
|
54
|
Chris@16
|
55 // agurt, 10/nov/06: use enums for Borland (which cannot cope with static constants)
|
Chris@16
|
56 // and GCC (which issues "unused variable" warnings when static constants are used
|
Chris@16
|
57 // at a function scope)
|
Chris@16
|
58 #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) \
|
Chris@101
|
59 || (BOOST_MPL_CFG_GCC != 0) || (BOOST_MPL_CFG_GPU != 0)
|
Chris@16
|
60 # define BOOST_MPL_AUX_ASSERT_CONSTANT(T, expr) enum { expr }
|
Chris@16
|
61 #else
|
Chris@16
|
62 # define BOOST_MPL_AUX_ASSERT_CONSTANT(T, expr) BOOST_STATIC_CONSTANT(T, expr)
|
Chris@16
|
63 #endif
|
Chris@16
|
64
|
Chris@16
|
65
|
Chris@16
|
66 BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN
|
Chris@16
|
67
|
Chris@16
|
68 struct failed {};
|
Chris@16
|
69
|
Chris@16
|
70 // agurt, 24/aug/04: MSVC 7.1 workaround here and below: return/accept
|
Chris@16
|
71 // 'assert<false>' by reference; can't apply it unconditionally -- apparently it
|
Chris@16
|
72 // degrades the quality of GCC diagnostics
|
Chris@16
|
73 #if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
|
Chris@16
|
74 # define AUX778076_ASSERT_ARG(x) x&
|
Chris@16
|
75 #else
|
Chris@16
|
76 # define AUX778076_ASSERT_ARG(x) x
|
Chris@16
|
77 #endif
|
Chris@16
|
78
|
Chris@16
|
79 template< bool C > struct assert { typedef void* type; };
|
Chris@16
|
80 template<> struct assert<false> { typedef AUX778076_ASSERT_ARG(assert) type; };
|
Chris@16
|
81
|
Chris@16
|
82 template< bool C >
|
Chris@16
|
83 int assertion_failed( typename assert<C>::type );
|
Chris@16
|
84
|
Chris@16
|
85 template< bool C >
|
Chris@16
|
86 struct assertion
|
Chris@16
|
87 {
|
Chris@16
|
88 static int failed( assert<false> );
|
Chris@16
|
89 };
|
Chris@16
|
90
|
Chris@16
|
91 template<>
|
Chris@16
|
92 struct assertion<true>
|
Chris@16
|
93 {
|
Chris@16
|
94 static int failed( void* );
|
Chris@16
|
95 };
|
Chris@16
|
96
|
Chris@16
|
97 struct assert_
|
Chris@16
|
98 {
|
Chris@16
|
99 #if !defined(BOOST_MPL_CFG_NO_DEFAULT_PARAMETERS_IN_NESTED_TEMPLATES)
|
Chris@16
|
100 template< typename T1, typename T2 = na, typename T3 = na, typename T4 = na > struct types {};
|
Chris@16
|
101 #endif
|
Chris@16
|
102 static assert_ const arg;
|
Chris@16
|
103 enum relations { equal = 1, not_equal, greater, greater_equal, less, less_equal };
|
Chris@16
|
104 };
|
Chris@16
|
105
|
Chris@16
|
106
|
Chris@16
|
107 #if !defined(BOOST_MPL_CFG_ASSERT_USE_RELATION_NAMES)
|
Chris@16
|
108
|
Chris@16
|
109 bool operator==( failed, failed );
|
Chris@16
|
110 bool operator!=( failed, failed );
|
Chris@16
|
111 bool operator>( failed, failed );
|
Chris@16
|
112 bool operator>=( failed, failed );
|
Chris@16
|
113 bool operator<( failed, failed );
|
Chris@16
|
114 bool operator<=( failed, failed );
|
Chris@16
|
115
|
Chris@16
|
116 #if defined(__EDG_VERSION__)
|
Chris@16
|
117 template< bool (*)(failed, failed), long x, long y > struct assert_relation {};
|
Chris@16
|
118 # define BOOST_MPL_AUX_ASSERT_RELATION(x, y, r) assert_relation<r,x,y>
|
Chris@16
|
119 #else
|
Chris@16
|
120 template< BOOST_MPL_AUX_NTTP_DECL(long, x), BOOST_MPL_AUX_NTTP_DECL(long, y), bool (*)(failed, failed) >
|
Chris@16
|
121 struct assert_relation {};
|
Chris@16
|
122 # define BOOST_MPL_AUX_ASSERT_RELATION(x, y, r) assert_relation<x,y,r>
|
Chris@16
|
123 #endif
|
Chris@16
|
124
|
Chris@16
|
125 #else // BOOST_MPL_CFG_ASSERT_USE_RELATION_NAMES
|
Chris@16
|
126
|
Chris@16
|
127 boost::mpl::aux::weighted_tag<1>::type operator==( assert_, assert_ );
|
Chris@16
|
128 boost::mpl::aux::weighted_tag<2>::type operator!=( assert_, assert_ );
|
Chris@16
|
129 boost::mpl::aux::weighted_tag<3>::type operator>( assert_, assert_ );
|
Chris@16
|
130 boost::mpl::aux::weighted_tag<4>::type operator>=( assert_, assert_ );
|
Chris@16
|
131 boost::mpl::aux::weighted_tag<5>::type operator<( assert_, assert_ );
|
Chris@16
|
132 boost::mpl::aux::weighted_tag<6>::type operator<=( assert_, assert_ );
|
Chris@16
|
133
|
Chris@16
|
134 template< assert_::relations r, long x, long y > struct assert_relation {};
|
Chris@16
|
135
|
Chris@16
|
136 #endif
|
Chris@16
|
137
|
Chris@16
|
138 #if BOOST_WORKAROUND(BOOST_MSVC, == 1700)
|
Chris@16
|
139
|
Chris@16
|
140 template<class Pred>
|
Chris@16
|
141 struct extract_assert_pred;
|
Chris@16
|
142
|
Chris@16
|
143 template<class Pred>
|
Chris@16
|
144 struct extract_assert_pred<void(Pred)> { typedef Pred type; };
|
Chris@16
|
145
|
Chris@16
|
146 template<class Pred>
|
Chris@16
|
147 struct eval_assert {
|
Chris@16
|
148 typedef typename extract_assert_pred<Pred>::type P;
|
Chris@16
|
149 typedef typename P::type p_type;
|
Chris@16
|
150 typedef typename ::boost::mpl::if_c<p_type::value,
|
Chris@16
|
151 AUX778076_ASSERT_ARG(assert<false>),
|
Chris@16
|
152 failed ************ P::************
|
Chris@16
|
153 >::type type;
|
Chris@16
|
154 };
|
Chris@16
|
155
|
Chris@16
|
156 template<class Pred>
|
Chris@16
|
157 struct eval_assert_not {
|
Chris@16
|
158 typedef typename extract_assert_pred<Pred>::type P;
|
Chris@16
|
159 typedef typename P::type p_type;
|
Chris@16
|
160 typedef typename ::boost::mpl::if_c<!p_type::value,
|
Chris@16
|
161 AUX778076_ASSERT_ARG(assert<false>),
|
Chris@16
|
162 failed ************ ::boost::mpl::not_<P>::************
|
Chris@16
|
163 >::type type;
|
Chris@16
|
164 };
|
Chris@16
|
165
|
Chris@16
|
166 template< typename T >
|
Chris@16
|
167 T make_assert_arg();
|
Chris@16
|
168
|
Chris@16
|
169 #elif !defined(BOOST_MPL_CFG_ASSERT_BROKEN_POINTER_TO_POINTER_TO_MEMBER)
|
Chris@16
|
170
|
Chris@16
|
171 template< bool > struct assert_arg_pred_impl { typedef int type; };
|
Chris@16
|
172 template<> struct assert_arg_pred_impl<true> { typedef void* type; };
|
Chris@16
|
173
|
Chris@16
|
174 template< typename P > struct assert_arg_pred
|
Chris@16
|
175 {
|
Chris@16
|
176 typedef typename P::type p_type;
|
Chris@16
|
177 typedef typename assert_arg_pred_impl< p_type::value >::type type;
|
Chris@16
|
178 };
|
Chris@16
|
179
|
Chris@16
|
180 template< typename P > struct assert_arg_pred_not
|
Chris@16
|
181 {
|
Chris@16
|
182 typedef typename P::type p_type;
|
Chris@16
|
183 BOOST_MPL_AUX_ASSERT_CONSTANT( bool, p = !p_type::value );
|
Chris@16
|
184 typedef typename assert_arg_pred_impl<p>::type type;
|
Chris@16
|
185 };
|
Chris@16
|
186
|
Chris@16
|
187 template< typename Pred >
|
Chris@16
|
188 failed ************ (Pred::************
|
Chris@16
|
189 assert_arg( void (*)(Pred), typename assert_arg_pred<Pred>::type )
|
Chris@16
|
190 );
|
Chris@16
|
191
|
Chris@16
|
192 template< typename Pred >
|
Chris@16
|
193 failed ************ (boost::mpl::not_<Pred>::************
|
Chris@16
|
194 assert_not_arg( void (*)(Pred), typename assert_arg_pred_not<Pred>::type )
|
Chris@16
|
195 );
|
Chris@16
|
196
|
Chris@16
|
197 template< typename Pred >
|
Chris@16
|
198 AUX778076_ASSERT_ARG(assert<false>)
|
Chris@16
|
199 assert_arg( void (*)(Pred), typename assert_arg_pred_not<Pred>::type );
|
Chris@16
|
200
|
Chris@16
|
201 template< typename Pred >
|
Chris@16
|
202 AUX778076_ASSERT_ARG(assert<false>)
|
Chris@16
|
203 assert_not_arg( void (*)(Pred), typename assert_arg_pred<Pred>::type );
|
Chris@16
|
204
|
Chris@16
|
205
|
Chris@16
|
206 #else // BOOST_MPL_CFG_ASSERT_BROKEN_POINTER_TO_POINTER_TO_MEMBER
|
Chris@16
|
207
|
Chris@16
|
208 template< bool c, typename Pred > struct assert_arg_type_impl
|
Chris@16
|
209 {
|
Chris@16
|
210 typedef failed ************ Pred::* mwcw83_wknd;
|
Chris@16
|
211 typedef mwcw83_wknd ************* type;
|
Chris@16
|
212 };
|
Chris@16
|
213
|
Chris@16
|
214 template< typename Pred > struct assert_arg_type_impl<true,Pred>
|
Chris@16
|
215 {
|
Chris@16
|
216 typedef AUX778076_ASSERT_ARG(assert<false>) type;
|
Chris@16
|
217 };
|
Chris@16
|
218
|
Chris@16
|
219 template< typename Pred > struct assert_arg_type
|
Chris@16
|
220 : assert_arg_type_impl< BOOST_MPL_AUX_VALUE_WKND(BOOST_MPL_AUX_NESTED_TYPE_WKND(Pred))::value, Pred >
|
Chris@16
|
221 {
|
Chris@16
|
222 };
|
Chris@16
|
223
|
Chris@16
|
224 template< typename Pred >
|
Chris@16
|
225 typename assert_arg_type<Pred>::type
|
Chris@16
|
226 assert_arg(void (*)(Pred), int);
|
Chris@16
|
227
|
Chris@16
|
228 template< typename Pred >
|
Chris@16
|
229 typename assert_arg_type< boost::mpl::not_<Pred> >::type
|
Chris@16
|
230 assert_not_arg(void (*)(Pred), int);
|
Chris@16
|
231
|
Chris@16
|
232 # if !defined(BOOST_MPL_CFG_ASSERT_USE_RELATION_NAMES)
|
Chris@16
|
233 template< long x, long y, bool (*r)(failed, failed) >
|
Chris@16
|
234 typename assert_arg_type_impl< false,BOOST_MPL_AUX_ASSERT_RELATION(x,y,r) >::type
|
Chris@16
|
235 assert_rel_arg( BOOST_MPL_AUX_ASSERT_RELATION(x,y,r) );
|
Chris@16
|
236 # else
|
Chris@16
|
237 template< assert_::relations r, long x, long y >
|
Chris@16
|
238 typename assert_arg_type_impl< false,assert_relation<r,x,y> >::type
|
Chris@16
|
239 assert_rel_arg( assert_relation<r,x,y> );
|
Chris@16
|
240 # endif
|
Chris@16
|
241
|
Chris@16
|
242 #endif // BOOST_MPL_CFG_ASSERT_BROKEN_POINTER_TO_POINTER_TO_MEMBER
|
Chris@16
|
243
|
Chris@16
|
244 #undef AUX778076_ASSERT_ARG
|
Chris@16
|
245
|
Chris@16
|
246 BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
|
Chris@16
|
247
|
Chris@16
|
248 #if BOOST_WORKAROUND(BOOST_MSVC, == 1700)
|
Chris@16
|
249
|
Chris@16
|
250 // BOOST_MPL_ASSERT((pred<x,...>))
|
Chris@16
|
251
|
Chris@16
|
252 #define BOOST_MPL_ASSERT(pred) \
|
Chris@16
|
253 BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
Chris@16
|
254 std::size_t \
|
Chris@16
|
255 , BOOST_PP_CAT(mpl_assertion_in_line_,BOOST_MPL_AUX_PP_COUNTER()) = sizeof( \
|
Chris@16
|
256 boost::mpl::assertion_failed<false>( \
|
Chris@16
|
257 boost::mpl::make_assert_arg< \
|
Chris@16
|
258 typename boost::mpl::eval_assert<void pred>::type \
|
Chris@16
|
259 >() \
|
Chris@16
|
260 ) \
|
Chris@16
|
261 ) \
|
Chris@16
|
262 ) \
|
Chris@16
|
263 /**/
|
Chris@16
|
264
|
Chris@16
|
265 // BOOST_MPL_ASSERT_NOT((pred<x,...>))
|
Chris@16
|
266
|
Chris@16
|
267 #define BOOST_MPL_ASSERT_NOT(pred) \
|
Chris@16
|
268 BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
Chris@16
|
269 std::size_t \
|
Chris@16
|
270 , BOOST_PP_CAT(mpl_assertion_in_line_,BOOST_MPL_AUX_PP_COUNTER()) = sizeof( \
|
Chris@16
|
271 boost::mpl::assertion_failed<false>( \
|
Chris@16
|
272 boost::mpl::make_assert_arg< \
|
Chris@16
|
273 typename boost::mpl::eval_assert_not<void pred>::type \
|
Chris@16
|
274 >() \
|
Chris@16
|
275 ) \
|
Chris@16
|
276 ) \
|
Chris@16
|
277 ) \
|
Chris@16
|
278 /**/
|
Chris@16
|
279
|
Chris@16
|
280 #else
|
Chris@16
|
281
|
Chris@16
|
282 // BOOST_MPL_ASSERT((pred<x,...>))
|
Chris@16
|
283
|
Chris@16
|
284 #define BOOST_MPL_ASSERT(pred) \
|
Chris@16
|
285 BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
Chris@16
|
286 std::size_t \
|
Chris@16
|
287 , BOOST_PP_CAT(mpl_assertion_in_line_,BOOST_MPL_AUX_PP_COUNTER()) = sizeof( \
|
Chris@16
|
288 boost::mpl::assertion_failed<false>( \
|
Chris@16
|
289 boost::mpl::assert_arg( (void (*) pred)0, 1 ) \
|
Chris@16
|
290 ) \
|
Chris@16
|
291 ) \
|
Chris@16
|
292 ) \
|
Chris@16
|
293 /**/
|
Chris@16
|
294
|
Chris@16
|
295 // BOOST_MPL_ASSERT_NOT((pred<x,...>))
|
Chris@16
|
296
|
Chris@16
|
297 #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
Chris@16
|
298 # define BOOST_MPL_ASSERT_NOT(pred) \
|
Chris@16
|
299 enum { \
|
Chris@16
|
300 BOOST_PP_CAT(mpl_assertion_in_line_,BOOST_MPL_AUX_PP_COUNTER()) = sizeof( \
|
Chris@16
|
301 boost::mpl::assertion<false>::failed( \
|
Chris@16
|
302 boost::mpl::assert_not_arg( (void (*) pred)0, 1 ) \
|
Chris@16
|
303 ) \
|
Chris@16
|
304 ) \
|
Chris@16
|
305 }\
|
Chris@16
|
306 /**/
|
Chris@16
|
307 #else
|
Chris@16
|
308 # define BOOST_MPL_ASSERT_NOT(pred) \
|
Chris@16
|
309 BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
Chris@16
|
310 std::size_t \
|
Chris@16
|
311 , BOOST_PP_CAT(mpl_assertion_in_line_,BOOST_MPL_AUX_PP_COUNTER()) = sizeof( \
|
Chris@16
|
312 boost::mpl::assertion_failed<false>( \
|
Chris@16
|
313 boost::mpl::assert_not_arg( (void (*) pred)0, 1 ) \
|
Chris@16
|
314 ) \
|
Chris@16
|
315 ) \
|
Chris@16
|
316 ) \
|
Chris@16
|
317 /**/
|
Chris@16
|
318 #endif
|
Chris@16
|
319
|
Chris@16
|
320 #endif
|
Chris@16
|
321
|
Chris@16
|
322 // BOOST_MPL_ASSERT_RELATION(x, ==|!=|<=|<|>=|>, y)
|
Chris@16
|
323
|
Chris@16
|
324 #if defined(BOOST_MPL_CFG_ASSERT_USE_RELATION_NAMES)
|
Chris@16
|
325
|
Chris@16
|
326 # if !defined(BOOST_MPL_CFG_ASSERT_BROKEN_POINTER_TO_POINTER_TO_MEMBER)
|
Chris@16
|
327 // agurt, 9/nov/06: 'enum' below is a workaround for gcc 4.0.4/4.1.1 bugs #29522 and #29518
|
Chris@16
|
328 # define BOOST_MPL_ASSERT_RELATION_IMPL(counter, x, rel, y) \
|
Chris@16
|
329 enum { BOOST_PP_CAT(mpl_assert_rel_value,counter) = (x rel y) }; \
|
Chris@16
|
330 BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
Chris@16
|
331 std::size_t \
|
Chris@16
|
332 , BOOST_PP_CAT(mpl_assertion_in_line_,counter) = sizeof( \
|
Chris@16
|
333 boost::mpl::assertion_failed<BOOST_PP_CAT(mpl_assert_rel_value,counter)>( \
|
Chris@16
|
334 (boost::mpl::failed ************ ( boost::mpl::assert_relation< \
|
Chris@16
|
335 boost::mpl::assert_::relations( sizeof( \
|
Chris@16
|
336 boost::mpl::assert_::arg rel boost::mpl::assert_::arg \
|
Chris@16
|
337 ) ) \
|
Chris@16
|
338 , x \
|
Chris@16
|
339 , y \
|
Chris@16
|
340 >::************)) 0 ) \
|
Chris@16
|
341 ) \
|
Chris@16
|
342 ) \
|
Chris@16
|
343 /**/
|
Chris@16
|
344 # else
|
Chris@16
|
345 # define BOOST_MPL_ASSERT_RELATION_IMPL(counter, x, rel, y) \
|
Chris@16
|
346 BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
Chris@16
|
347 std::size_t \
|
Chris@16
|
348 , BOOST_PP_CAT(mpl_assert_rel,counter) = sizeof( \
|
Chris@16
|
349 boost::mpl::assert_::arg rel boost::mpl::assert_::arg \
|
Chris@16
|
350 ) \
|
Chris@16
|
351 ); \
|
Chris@16
|
352 BOOST_MPL_AUX_ASSERT_CONSTANT( bool, BOOST_PP_CAT(mpl_assert_rel_value,counter) = (x rel y) ); \
|
Chris@16
|
353 BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
Chris@16
|
354 std::size_t \
|
Chris@16
|
355 , BOOST_PP_CAT(mpl_assertion_in_line_,counter) = sizeof( \
|
Chris@16
|
356 boost::mpl::assertion_failed<BOOST_PP_CAT(mpl_assert_rel_value,counter)>( \
|
Chris@16
|
357 boost::mpl::assert_rel_arg( boost::mpl::assert_relation< \
|
Chris@16
|
358 boost::mpl::assert_::relations(BOOST_PP_CAT(mpl_assert_rel,counter)) \
|
Chris@16
|
359 , x \
|
Chris@16
|
360 , y \
|
Chris@16
|
361 >() ) \
|
Chris@16
|
362 ) \
|
Chris@16
|
363 ) \
|
Chris@16
|
364 ) \
|
Chris@16
|
365 /**/
|
Chris@16
|
366 # endif
|
Chris@16
|
367
|
Chris@16
|
368 # define BOOST_MPL_ASSERT_RELATION(x, rel, y) \
|
Chris@16
|
369 BOOST_MPL_ASSERT_RELATION_IMPL(BOOST_MPL_AUX_PP_COUNTER(), x, rel, y) \
|
Chris@16
|
370 /**/
|
Chris@16
|
371
|
Chris@16
|
372 #else // !BOOST_MPL_CFG_ASSERT_USE_RELATION_NAMES
|
Chris@16
|
373
|
Chris@16
|
374 # if defined(BOOST_MPL_CFG_ASSERT_BROKEN_POINTER_TO_POINTER_TO_MEMBER)
|
Chris@16
|
375 # define BOOST_MPL_ASSERT_RELATION(x, rel, y) \
|
Chris@16
|
376 BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
Chris@16
|
377 std::size_t \
|
Chris@16
|
378 , BOOST_PP_CAT(mpl_assertion_in_line_,BOOST_MPL_AUX_PP_COUNTER()) = sizeof( \
|
Chris@16
|
379 boost::mpl::assertion_failed<(x rel y)>( boost::mpl::assert_rel_arg( \
|
Chris@16
|
380 boost::mpl::BOOST_MPL_AUX_ASSERT_RELATION(x,y,(&boost::mpl::operator rel))() \
|
Chris@16
|
381 ) ) \
|
Chris@16
|
382 ) \
|
Chris@16
|
383 ) \
|
Chris@16
|
384 /**/
|
Chris@16
|
385 # else
|
Chris@16
|
386 # define BOOST_MPL_ASSERT_RELATION(x, rel, y) \
|
Chris@16
|
387 BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
Chris@16
|
388 std::size_t \
|
Chris@16
|
389 , BOOST_PP_CAT(mpl_assertion_in_line_,BOOST_MPL_AUX_PP_COUNTER()) = sizeof( \
|
Chris@16
|
390 boost::mpl::assertion_failed<(x rel y)>( (boost::mpl::failed ************ ( \
|
Chris@16
|
391 boost::mpl::BOOST_MPL_AUX_ASSERT_RELATION(x,y,(&boost::mpl::operator rel))::************))0 ) \
|
Chris@16
|
392 ) \
|
Chris@16
|
393 ) \
|
Chris@16
|
394 /**/
|
Chris@16
|
395 # endif
|
Chris@16
|
396
|
Chris@16
|
397 #endif
|
Chris@16
|
398
|
Chris@16
|
399
|
Chris@16
|
400 // BOOST_MPL_ASSERT_MSG( (pred<x,...>::value), USER_PROVIDED_MESSAGE, (types<x,...>) )
|
Chris@16
|
401
|
Chris@16
|
402 #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202))
|
Chris@16
|
403 # define BOOST_MPL_ASSERT_MSG_IMPL( counter, c, msg, types_ ) \
|
Chris@16
|
404 struct msg; \
|
Chris@16
|
405 typedef struct BOOST_PP_CAT(msg,counter) : boost::mpl::assert_ \
|
Chris@16
|
406 { \
|
Chris@16
|
407 using boost::mpl::assert_::types; \
|
Chris@16
|
408 static boost::mpl::failed ************ (msg::************ assert_arg()) types_ \
|
Chris@16
|
409 { return 0; } \
|
Chris@16
|
410 } BOOST_PP_CAT(mpl_assert_arg,counter); \
|
Chris@16
|
411 BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
Chris@16
|
412 std::size_t \
|
Chris@16
|
413 , BOOST_PP_CAT(mpl_assertion_in_line_,counter) = sizeof( \
|
Chris@16
|
414 boost::mpl::assertion<(c)>::failed( BOOST_PP_CAT(mpl_assert_arg,counter)::assert_arg() ) \
|
Chris@16
|
415 ) \
|
Chris@16
|
416 ) \
|
Chris@16
|
417 /**/
|
Chris@16
|
418 #else
|
Chris@16
|
419 # define BOOST_MPL_ASSERT_MSG_IMPL( counter, c, msg, types_ ) \
|
Chris@16
|
420 struct msg; \
|
Chris@16
|
421 typedef struct BOOST_PP_CAT(msg,counter) : boost::mpl::assert_ \
|
Chris@16
|
422 { \
|
Chris@16
|
423 static boost::mpl::failed ************ (msg::************ assert_arg()) types_ \
|
Chris@16
|
424 { return 0; } \
|
Chris@16
|
425 } BOOST_PP_CAT(mpl_assert_arg,counter); \
|
Chris@16
|
426 BOOST_MPL_AUX_ASSERT_CONSTANT( \
|
Chris@16
|
427 std::size_t \
|
Chris@16
|
428 , BOOST_PP_CAT(mpl_assertion_in_line_,counter) = sizeof( \
|
Chris@16
|
429 boost::mpl::assertion_failed<(c)>( BOOST_PP_CAT(mpl_assert_arg,counter)::assert_arg() ) \
|
Chris@16
|
430 ) \
|
Chris@16
|
431 ) \
|
Chris@16
|
432 /**/
|
Chris@16
|
433 #endif
|
Chris@16
|
434
|
Chris@16
|
435 #define BOOST_MPL_ASSERT_MSG( c, msg, types_ ) \
|
Chris@16
|
436 BOOST_MPL_ASSERT_MSG_IMPL( BOOST_MPL_AUX_PP_COUNTER(), c, msg, types_ ) \
|
Chris@16
|
437 /**/
|
Chris@16
|
438
|
Chris@16
|
439 #endif // BOOST_MPL_ASSERT_HPP_INCLUDED
|