• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3	<title>BOOST_PP_ASSERT</title>
4	<link rel="stylesheet" type="text/css" href="../styles.css">
5</head>
6<body>
7	<div style="margin-left:  0px;">
8		The <b>BOOST_PP_ASSERT</b> macro conditionally causes a preprocessing error.
9	</div>
10	<h4>Usage</h4>
11		<div class="code">
12			<b>BOOST_PP_ASSERT</b>(<i>cond</i>)
13		</div>
14	<h4>Arguments</h4>
15		<dl>
16			<dt>cond</dt>
17			<dd>
18				A condition that determines whether an assertion occurs.&nbsp;
19				Valid values range from <i>0</i> to <b>BOOST_PP_LIMIT_MAG</b>.
20			</dd>
21		</dl>
22	<h4>Remarks</h4>
23		<div>
24			If <i>cond</i> expands to <i>0</i>, this macro causes a preprocessing error.&nbsp;
25			Otherwise, it expands to nothing.
26		</div>
27	<h4>See Also</h4>
28		<ul>
29			<li><a href="assert_msg.html">BOOST_PP_ASSERT_MSG</a></li>
30			<li><a href="limit_mag.html">BOOST_PP_LIMIT_MAG</a></li>
31		</ul>
32	<h4>Requirements</h4>
33		<div>
34			<b>Header:</b> &nbsp;<a href="../headers/debug/assert.html">&lt;boost/preprocessor/debug/assert.hpp&gt;</a>
35		</div>
36	<h4>Sample Code</h4>
37<div><pre>
38#include &lt;<a href="../headers/cat.html">boost/preprocessor/cat.hpp</a>&gt;
39#include &lt;<a href="../headers/debug/assert.html">boost/preprocessor/debug/assert.hpp</a>&gt;
40#include &lt;<a href="../headers/logical/bitnor.html">boost/preprocessor/logical/bitnor.hpp</a>&gt;
41#include &lt;<a href="../headers/logical/compl.html">boost/preprocessor/logical/compl.hpp</a>&gt;
42
43// The is BOOST_PP_IS_NULLARY macro is not part of
44// the public interface of the library because it
45// doesn't work on Borland preprocessors.  It is
46// only used here to illustrate assertions.  In
47// effect, it detects whether an argument is empty
48// parenthesis or some text.
49
50#include &lt;boost/preprocessor/detail/is_nullary.hpp&gt;
51
52#define IS_EDISON_DESIGN_GROUP() \
53   <a href="compl.html">BOOST_PP_COMPL</a>( \
54      BOOST_PP_IS_NULLARY( \
55         <a href="cat.html">BOOST_PP_CAT</a>(IS_EDG_CHECK, __EDG_VERSION) \
56      ) \
57   ) \
58   /**/
59#define IS_EDG_CHECK__EDG_VERSION ()
60
61#define IS_METROWERKS() \
62   <a href="compl.html">BOOST_PP_COMPL</a>( \
63      BOOST_PP_IS_NULLARY( \
64         <a href="cat.html">BOOST_PP_CAT</a>(IS_MWERKS_CHECK, __MWERKS__) \
65      ) \
66   ) \
67   /**/
68#define IS_MWERKS_CHECK__MWERKS__ ()
69
70#define IS_MICROSOFT() \
71   <a href="bitnor.html">BOOST_PP_BITNOR</a>( \
72      IS_MICROSOFT_ROOT(), \
73      IS_EDISON_DESIGN_GROUP() \
74   ) \
75   /**/
76#define IS_MICROSOFT_ROOT() \
77   BOOST_PP_IS_NULLARY( \
78      <a href="cat.html">BOOST_PP_CAT</a>(IS_MSVC_CHECK, _MSC_VER) \
79   ) \
80   /**/
81#define IS_MSVC_CHECK_MS_VER ()
82
83// this macro doesn't work on EDG...
84// (this is just an example)
85
86#define MACRO(n) \
87   <a href="cat.html">BOOST_PP_CAT</a>( \
88      MACRO_, \
89      IS_EDISON_DESIGN_GROUP() \
90   )(n) \
91   /**/
92
93#define MACRO_1(n) \
94   <a href="assert.html">BOOST_PP_ASSERT</a>(0) \
95   "Edison Design Group is not supported" \
96   /**/
97
98#define MACRO_0(n) normal mode: n
99
100MACRO(10)
101</pre></div>
102	<hr size="1">
103	<div style="margin-left: 0px;">
104		<i>� Copyright <a href="http://www.housemarque.com" target="_top">Housemarque Oy</a> 2002</i>
105		</br><i>� Copyright Paul Mensonides 2002</i>
106	</div>
107	<div style="margin-left: 0px;">
108		<p><small>Distributed under the Boost Software License, Version 1.0. (See
109		accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
110		copy at <a href=
111		"http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
112	</div>
113</body>
114</html>
115