is_empty_variadic.hpp 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. # /* **************************************************************************
  2. # * *
  3. # * (C) Copyright Edward Diener 2014,2019.
  4. # * Distributed under the Boost Software License, Version 1.0. (See
  5. # * accompanying file LICENSE_1_0.txt or copy at
  6. # * http://www.boost.org/LICENSE_1_0.txt)
  7. # * *
  8. # ************************************************************************** */
  9. #
  10. # /* See http://www.boost.org for most recent version. */
  11. #
  12. # ifndef BOOST_PREPROCESSOR_FACILITIES_IS_EMPTY_VARIADIC_HPP
  13. # define BOOST_PREPROCESSOR_FACILITIES_IS_EMPTY_VARIADIC_HPP
  14. #
  15. # include <boost/preprocessor/config/config.hpp>
  16. # include <boost/preprocessor/punctuation/is_begin_parens.hpp>
  17. # include <boost/preprocessor/facilities/detail/is_empty.hpp>
  18. #
  19. #if BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400
  20. #
  21. #define BOOST_PP_IS_EMPTY(param) \
  22. BOOST_PP_DETAIL_IS_EMPTY_IIF \
  23. ( \
  24. BOOST_PP_IS_BEGIN_PARENS \
  25. ( \
  26. param \
  27. ) \
  28. ) \
  29. ( \
  30. BOOST_PP_IS_EMPTY_ZERO, \
  31. BOOST_PP_DETAIL_IS_EMPTY_PROCESS \
  32. ) \
  33. (param) \
  34. /**/
  35. #define BOOST_PP_IS_EMPTY_ZERO(param) 0
  36. # else
  37. # if defined(__cplusplus) && __cplusplus > 201703L
  38. # include <boost/preprocessor/variadic/has_opt.hpp>
  39. #define BOOST_PP_IS_EMPTY(...) \
  40. BOOST_PP_DETAIL_IS_EMPTY_IIF \
  41. ( \
  42. BOOST_PP_VARIADIC_HAS_OPT() \
  43. ) \
  44. ( \
  45. BOOST_PP_IS_EMPTY_OPT, \
  46. BOOST_PP_IS_EMPTY_NO_OPT \
  47. ) \
  48. (__VA_ARGS__) \
  49. /**/
  50. #define BOOST_PP_IS_EMPTY_FUNCTION2(...) \
  51. __VA_OPT__(0,) 1 \
  52. /**/
  53. #define BOOST_PP_IS_EMPTY_FUNCTION(...) \
  54. BOOST_PP_IS_EMPTY_FUNCTION2(__VA_ARGS__) \
  55. /**/
  56. #define BOOST_PP_IS_EMPTY_OPT(...) \
  57. BOOST_PP_VARIADIC_HAS_OPT_ELEM0(BOOST_PP_IS_EMPTY_FUNCTION(__VA_ARGS__),) \
  58. /**/
  59. # else
  60. #define BOOST_PP_IS_EMPTY(...) \
  61. BOOST_PP_IS_EMPTY_NO_OPT(__VA_ARGS__) \
  62. /**/
  63. # endif /* defined(__cplusplus) && __cplusplus > 201703L */
  64. #define BOOST_PP_IS_EMPTY_NO_OPT(...) \
  65. BOOST_PP_DETAIL_IS_EMPTY_IIF \
  66. ( \
  67. BOOST_PP_IS_BEGIN_PARENS \
  68. ( \
  69. __VA_ARGS__ \
  70. ) \
  71. ) \
  72. ( \
  73. BOOST_PP_IS_EMPTY_ZERO, \
  74. BOOST_PP_DETAIL_IS_EMPTY_PROCESS \
  75. ) \
  76. (__VA_ARGS__) \
  77. /**/
  78. #define BOOST_PP_IS_EMPTY_ZERO(...) 0
  79. # endif /* BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400 */
  80. # endif /* BOOST_PREPROCESSOR_FACILITIES_IS_EMPTY_VARIADIC_HPP */