preprocessor/doc/ref/check_empty.html
2019-10-19 10:51:40 -04:00

69 lines
2.7 KiB
HTML
Raw Permalink Blame History

<html>
<head>
<title>BOOST_PP_CHECK_EMPTY</title>
<link rel="stylesheet" type="text/css" href="../styles.css">
</head>
<body>
<div style="margin-left: 0px;"> The <b>BOOST_PP_CHECK_EMPTY</b> variadic macro
checks to see if its variadic input is empty or not. It expands to 1 if its input
is empty and expands to 0 if its input is not empty. The macro only exists when
the compilation is at the C++20 level and the __VA_OPT__ construct is supported.</div>
<h4>Usage</h4>
<div class="code"> <b>BOOST_PP_CHECK_EMPTY</b>(<i>...</i>) <a href="../topics/variadic_macros.html#VNotation" target="_self"><sup>(v)</sup></a><br>
</div>
<h4>Arguments</h4>
<dl>
<dt>...<br>
</dt>
<dd> The <i>variadic data</i> to be checked for emptiness. </dd>
</dl>
<h4>Remarks</h4>
<div>
When the macro invocation BOOST_PP_VARIADIC_HAS_OPT() expands to 1, then this
macro exists and can be invoked, otherwise this macro does not exist
and attempting to invoke it will lead to a preprocessor error that the macro
can not be found. Because of this condition the header file for including
this macro includes the header file for the BOOST_PP_VARIADIC_HAS_OPT macro.<br>
It is possible to pass data to this macro which expands to nothing, in which
case this macro will expand to 1 just as if nothing has been passed.
</div>
<h4>See Also</h4>
<ul>
<li><a href="variadic_has_opt.html">BOOST_PP_VARIADIC_HAS_OPT</a></li>
</ul>
<h4>Requirements</h4>
<div> <b>Header:</b> &nbsp;<a href="../headers/facilities/check_empty.html">&lt;boost/preprocessor/facilities/check_empty.hpp&gt;</a>
</div>
<h4>Sample Code</h4>
<div>
<pre>
#include &lt;<a href="../headers/facilities/check_empty.html">boost/preprocessor/facilities/check_empty.hpp</a>&gt;
# if <a href="variadic_has_opt.html">BOOST_PP_VARIADIC_HAS_OPT</a>()
#define DATA
#define OBJECT OBJECT2
#define OBJECT2
#define FUNC(x) FUNC2(x)
#define FUNC2(x)
#define FUNC_GEN(x,y) (1,2,3)
<a href="check_empty.html">BOOST_PP_CHECK_EMPTY</a>(DATA) // expands to 1
<a href="check_empty.html">BOOST_PP_CHECK_EMPTY</a>(OBJECT) // expands to 1
<a href="check_empty.html">BOOST_PP_CHECK_EMPTY</a>(FUNC(1)) // expands to 1
<a href="check_empty.html">BOOST_PP_CHECK_EMPTY</a>(FUNC) // expands to 0
<a href="check_empty.html">BOOST_PP_CHECK_EMPTY</a>(FUNC_GEN) // expands to 0
#endif
</pre>
</div>
<hr size="1">
<div style="margin-left: 0px;"> <i></i><i><EFBFBD> Copyright Edward Diener 2019</i> </div>
<div style="margin-left: 0px;">
<p><small>Distributed under the Boost Software License, Version 1.0.
(See accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a>
or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
</div>
</body>
</html>