forked from boostorg/preprocessor
97 lines
3.0 KiB
HTML
97 lines
3.0 KiB
HTML
<html>
|
|
<head>
|
|
<title>BOOST_PP_ASSERT</title>
|
|
<link rel="stylesheet" type="text/css" href="../styles.css">
|
|
<script language="javascript" type="text/javascript" src="../scripts.js"></script>
|
|
</head>
|
|
<body onload="init('sample');">
|
|
<div style="margin-left: 0px;">
|
|
The <b>BOOST_PP_ASSERT</b> macro conditionally causes a preprocessing error.
|
|
</div>
|
|
<h4>Usage</h4>
|
|
<div class="code">
|
|
<b>BOOST_PP_ASSERT</b>(<i>cond</i>)
|
|
</div>
|
|
<h4>Arguments</h4>
|
|
<dl>
|
|
<dt>cond</dt>
|
|
<dd>
|
|
A condition that determines whether an assertion occurs.
|
|
Valid values range from <i>0</i> to <b>BOOST_PP_LIMIT_MAG</b>.
|
|
</dd>
|
|
</dl>
|
|
<h4>Remarks</h4>
|
|
<div>
|
|
If <i>cond</i> expands to <i>0</i>, this macro causes a preprocessing error.
|
|
Otherwise, it expands to nothing.
|
|
</div>
|
|
<h4>See Also</h4>
|
|
<ul>
|
|
<li><a href="assert_msg.html">BOOST_PP_ASSERT_MSG</a></li>
|
|
<li><a href="limit_mag.html">BOOST_PP_LIMIT_MAG</a></li>
|
|
</ul>
|
|
<h4>Requirements</h4>
|
|
<div>
|
|
<b>Header:</b> <a href="../headers/debug/assert.hpp.html"><boost/preprocessor/debug/assert.hpp></a>
|
|
</div>
|
|
<h4><a class="local" onclick="toggle('sample');" onmouseover="change(this);" onmouseout="revert(this);">Sample Code</a></h4>
|
|
<div id="sample"><pre>
|
|
#include <boost/preprocessor/cat.hpp>
|
|
#include <boost/preprocessor/debug/assert.hpp>
|
|
#include <boost/preprocessor/detail/is_nullary.hpp>
|
|
#include <boost/preprocessor/logical/bitnor.hpp>
|
|
#include <boost/preprocessor/logical/compl.hpp>
|
|
|
|
#define IS_EDISON_DESIGN_GROUP() /* ..... */ \
|
|
BOOST_PP_COMPL( \
|
|
BOOST_PP_IS_NULLARY( \
|
|
BOOST_PP_CAT(IS_EDG_CHECK, __EDG__) \
|
|
) \
|
|
) \
|
|
/**/
|
|
#define IS_EDG_CHECK__EDG__ ()
|
|
|
|
#define IS_METROWERKS() /* .................... */ \
|
|
BOOST_PP_COMPL( \
|
|
BOOST_PP_IS_NULLARY( \
|
|
BOOST_PP_CAT(IS_MWERKS_CHECK, __MWERKS__) \
|
|
) \
|
|
) \
|
|
/**/
|
|
#define IS_MWERKS_CHECK__MWERKS__ ()
|
|
|
|
#define IS_MICROSOFT() /* ... */ \
|
|
BOOST_PP_BITNOR( \
|
|
IS_MICROSOFT_ROOT(), \
|
|
IS_EDISON_DESIGN_GROUP() \
|
|
) \
|
|
/**/
|
|
#define IS_MICROSOFT_ROOT() /* ......... */ \
|
|
BOOST_PP_IS_NULLARY( \
|
|
BOOST_PP_CAT(IS_MSVC_CHECK, _MSC_VER) \
|
|
) \
|
|
/**/
|
|
#define IS_MSVC_CHECK_MS_VER ()
|
|
|
|
// this macro doesn't work on EDG...
|
|
// (this is just an example)
|
|
|
|
#define MACRO(n) /* ....... */ \
|
|
BOOST_PP_CAT( \
|
|
MACRO_, \
|
|
IS_EDISON_DESIGN_GROUP() \
|
|
)(n) \
|
|
/**/
|
|
|
|
#define MACRO_1(n) /* ................ */ \
|
|
BOOST_PP_ASSERT(0) \
|
|
"Edison Design Group is not supported" \
|
|
/**/
|
|
|
|
#define MACRO_0(n) normal mode: n
|
|
|
|
MACRO(10)
|
|
<pre></div>
|
|
</body>
|
|
</html>
|