is_empty.hpp 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # /* **************************************************************************
  2. # * *
  3. # * (C) Copyright Paul Mensonides 2003.
  4. # * (C) Copyright Edward Diener 2014.
  5. # * Distributed under the Boost Software License, Version 1.0. (See
  6. # * accompanying file LICENSE_1_0.txt or copy at
  7. # * http://www.boost.org/LICENSE_1_0.txt)
  8. # * *
  9. # ************************************************************************** */
  10. #
  11. # /* See http://www.boost.org for most recent version. */
  12. #
  13. # ifndef BOOST_PREPROCESSOR_FACILITIES_IS_EMPTY_HPP
  14. # define BOOST_PREPROCESSOR_FACILITIES_IS_EMPTY_HPP
  15. #
  16. # include <boost/preprocessor/config/config.hpp>
  17. #
  18. # if BOOST_PP_VARIADICS
  19. #
  20. # include <boost/preprocessor/facilities/is_empty_variadic.hpp>
  21. #
  22. # else
  23. #
  24. # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() && ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()
  25. # include <boost/preprocessor/tuple/elem.hpp>
  26. # include <boost/preprocessor/facilities/identity.hpp>
  27. # else
  28. # include <boost/preprocessor/cat.hpp>
  29. # include <boost/preprocessor/detail/split.hpp>
  30. # endif
  31. #
  32. # /* BOOST_PP_IS_EMPTY */
  33. #
  34. # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() && ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()
  35. # define BOOST_PP_IS_EMPTY(x) BOOST_PP_IS_EMPTY_I(x BOOST_PP_IS_EMPTY_HELPER)
  36. # define BOOST_PP_IS_EMPTY_I(contents) BOOST_PP_TUPLE_ELEM(2, 1, (BOOST_PP_IS_EMPTY_DEF_ ## contents()))
  37. # define BOOST_PP_IS_EMPTY_DEF_BOOST_PP_IS_EMPTY_HELPER 1, BOOST_PP_IDENTITY(1)
  38. # define BOOST_PP_IS_EMPTY_HELPER() , 0
  39. # else
  40. # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()
  41. # define BOOST_PP_IS_EMPTY(x) BOOST_PP_IS_EMPTY_I(BOOST_PP_IS_EMPTY_HELPER x ())
  42. # define BOOST_PP_IS_EMPTY_I(test) BOOST_PP_IS_EMPTY_II(BOOST_PP_SPLIT(0, BOOST_PP_CAT(BOOST_PP_IS_EMPTY_DEF_, test)))
  43. # define BOOST_PP_IS_EMPTY_II(id) id
  44. # else
  45. # define BOOST_PP_IS_EMPTY(x) BOOST_PP_IS_EMPTY_I((BOOST_PP_IS_EMPTY_HELPER x ()))
  46. # define BOOST_PP_IS_EMPTY_I(par) BOOST_PP_IS_EMPTY_II ## par
  47. # define BOOST_PP_IS_EMPTY_II(test) BOOST_PP_SPLIT(0, BOOST_PP_CAT(BOOST_PP_IS_EMPTY_DEF_, test))
  48. # endif
  49. # define BOOST_PP_IS_EMPTY_HELPER() 1
  50. # define BOOST_PP_IS_EMPTY_DEF_1 1, BOOST_PP_NIL
  51. # define BOOST_PP_IS_EMPTY_DEF_BOOST_PP_IS_EMPTY_HELPER 0, BOOST_PP_NIL
  52. # endif
  53. #
  54. # endif /* BOOST_PP_VARIADICS */
  55. #
  56. # endif /* BOOST_PREPROCESSOR_FACILITIES_IS_EMPTY_HPP */