is_empty_variadic.hpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. #
  17. # if BOOST_PP_VARIADICS
  18. #
  19. # include <boost/preprocessor/punctuation/is_begin_parens.hpp>
  20. # include <boost/preprocessor/facilities/detail/is_empty.hpp>
  21. #
  22. #if BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400
  23. #
  24. #define BOOST_PP_IS_EMPTY(param) \
  25. BOOST_PP_DETAIL_IS_EMPTY_IIF \
  26. ( \
  27. BOOST_PP_IS_BEGIN_PARENS \
  28. ( \
  29. param \
  30. ) \
  31. ) \
  32. ( \
  33. BOOST_PP_IS_EMPTY_ZERO, \
  34. BOOST_PP_DETAIL_IS_EMPTY_PROCESS \
  35. ) \
  36. (param) \
  37. /**/
  38. #define BOOST_PP_IS_EMPTY_ZERO(param) 0
  39. # else
  40. # if defined(__cplusplus) && __cplusplus > 201703L
  41. # include <boost/preprocessor/variadic/has_opt.hpp>
  42. #define BOOST_PP_IS_EMPTY(...) \
  43. BOOST_PP_DETAIL_IS_EMPTY_IIF \
  44. ( \
  45. BOOST_PP_VARIADIC_HAS_OPT() \
  46. ) \
  47. ( \
  48. BOOST_PP_IS_EMPTY_OPT, \
  49. BOOST_PP_IS_EMPTY_NO_OPT \
  50. ) \
  51. (__VA_ARGS__) \
  52. /**/
  53. #define BOOST_PP_IS_EMPTY_FUNCTION2(...) \
  54. __VA_OPT__(0,) 1 \
  55. /**/
  56. #define BOOST_PP_IS_EMPTY_FUNCTION(...) \
  57. BOOST_PP_IS_EMPTY_FUNCTION2(__VA_ARGS__) \
  58. /**/
  59. #define BOOST_PP_IS_EMPTY_OPT(...) \
  60. BOOST_PP_VARIADIC_HAS_OPT_ELEM0(BOOST_PP_IS_EMPTY_FUNCTION(__VA_ARGS__),) \
  61. /**/
  62. # else
  63. #define BOOST_PP_IS_EMPTY(...) \
  64. BOOST_PP_IS_EMPTY_NO_OPT(__VA_ARGS__) \
  65. /**/
  66. # endif /* defined(__cplusplus) && __cplusplus > 201703L */
  67. #define BOOST_PP_IS_EMPTY_NO_OPT(...) \
  68. BOOST_PP_DETAIL_IS_EMPTY_IIF \
  69. ( \
  70. BOOST_PP_IS_BEGIN_PARENS \
  71. ( \
  72. __VA_ARGS__ \
  73. ) \
  74. ) \
  75. ( \
  76. BOOST_PP_IS_EMPTY_ZERO, \
  77. BOOST_PP_DETAIL_IS_EMPTY_PROCESS \
  78. ) \
  79. (__VA_ARGS__) \
  80. /**/
  81. #define BOOST_PP_IS_EMPTY_ZERO(...) 0
  82. # endif /* BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400 */
  83. # endif /* BOOST_PP_VARIADICS */
  84. # endif /* BOOST_PREPROCESSOR_FACILITIES_IS_EMPTY_VARIADIC_HPP */