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