check_empty.html 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. # if <a href="variadic_has_opt.html">BOOST_PP_VARIADIC_HAS_OPT</a>()
  42. #define DATA
  43. #define OBJECT OBJECT2
  44. #define OBJECT2
  45. #define FUNC(x) FUNC2(x)
  46. #define FUNC2(x)
  47. #define FUNC_GEN(x,y) (1,2,3)
  48. <a href="check_empty.html">BOOST_PP_CHECK_EMPTY</a>(DATA) // expands to 1
  49. <a href="check_empty.html">BOOST_PP_CHECK_EMPTY</a>(OBJECT) // expands to 1
  50. <a href="check_empty.html">BOOST_PP_CHECK_EMPTY</a>(FUNC(1)) // expands to 1
  51. <a href="check_empty.html">BOOST_PP_CHECK_EMPTY</a>(FUNC) // expands to 0
  52. <a href="check_empty.html">BOOST_PP_CHECK_EMPTY</a>(FUNC_GEN) // expands to 0
  53. #endif
  54. </pre>
  55. </div>
  56. <hr size="1">
  57. <div style="margin-left: 0px;"> <i></i><i>© Copyright Edward Diener 2019</i> </div>
  58. <div style="margin-left: 0px;">
  59. <p><small>Distributed under the Boost Software License, Version 1.0.
  60. (See accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a>
  61. or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
  62. </div>
  63. </body>
  64. </html>