Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / preprocessor / doc / ref / check_empty.html
1 <html>
2 <head>
3   <title>BOOST_PP_CHECK_EMPTY</title>
4   <link rel="stylesheet" type="text/css" href="../styles.css">
5 </head>
6 <body>
7 <div style="margin-left: 0px;"> The <b>BOOST_PP_CHECK_EMPTY</b> variadic macro
8 checks to see if its variadic input is empty or not. It expands to 1 if its input
9 is empty and expands to 0 if its input is not empty. The macro only exists when
10 the compilation is at the C++20 level and the __VA_OPT__ construct is supported.</div>
11 <h4>Usage</h4>
12 <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>
13  </div>
14 <h4>Arguments</h4>
15 <dl>
16   <dt>...<br>
17 </dt>
18   <dd> The <i>variadic data</i> to be checked for emptiness. </dd>
19 </dl>
20 <h4>Remarks</h4>
21 <div>
22 When the macro invocation BOOST_PP_VARIADIC_HAS_OPT() expands to 1, then this
23 macro exists and can be invoked, otherwise this macro does not exist
24 and attempting to invoke it will lead to a preprocessor error that the macro
25 can not be found. Because of this condition the header file for including
26 this macro includes the header file for the BOOST_PP_VARIADIC_HAS_OPT macro.<br>
27 It is possible to pass data to this macro which expands to nothing, in which
28 case this macro will expand to 1 just as if nothing has been passed.
29 </div>
30 <h4>See Also</h4>
31 <ul>
32   <li><a href="variadic_has_opt.html">BOOST_PP_VARIADIC_HAS_OPT</a></li>
33 </ul>
34 <h4>Requirements</h4>
35 <div> <b>Header:</b> &nbsp;<a href="../headers/facilities/check_empty.html">&lt;boost/preprocessor/facilities/check_empty.hpp&gt;</a>
36 </div>
37 <h4>Sample Code</h4>
38 <div>
39 <pre>
40 #include &lt;<a href="../headers/facilities/check_empty.html">boost/preprocessor/facilities/check_empty.hpp</a>&gt;
41
42 # if <a href="variadic_has_opt.html">BOOST_PP_VARIADIC_HAS_OPT</a>()
43
44 #define DATA
45 #define OBJECT OBJECT2
46 #define OBJECT2
47 #define FUNC(x) FUNC2(x)
48 #define FUNC2(x)
49 #define FUNC_GEN(x,y) (1,2,3)
50
51 <a href="check_empty.html">BOOST_PP_CHECK_EMPTY</a>(DATA)     // expands to 1
52 <a href="check_empty.html">BOOST_PP_CHECK_EMPTY</a>(OBJECT)   // expands to 1
53 <a href="check_empty.html">BOOST_PP_CHECK_EMPTY</a>(FUNC(1))  // expands to 1
54 <a href="check_empty.html">BOOST_PP_CHECK_EMPTY</a>(FUNC)     // expands to 0
55 <a href="check_empty.html">BOOST_PP_CHECK_EMPTY</a>(FUNC_GEN) // expands to 0
56
57 #endif
58 </pre>
59 </div>
60 <hr size="1">
61 <div style="margin-left: 0px;"> <i></i><i>© Copyright Edward Diener 2019</i> </div>
62 <div style="margin-left: 0px;">
63 <p><small>Distributed under the Boost Software License, Version 1.0.
64 (See accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a>
65 or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
66 </div>
67 </body>
68 </html>