is_empty.hpp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # /* **************************************************************************
  2. # * *
  3. # * (C) Copyright Paul Mensonides 2003.
  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_HPP
  13. # define BOOST_PREPROCESSOR_FACILITIES_IS_EMPTY_HPP
  14. #
  15. # include <boost/preprocessor/config/config.hpp>
  16. # include <boost/preprocessor/cat.hpp>
  17. # include <boost/preprocessor/tuple/elem.hpp>
  18. # include <boost/preprocessor/facilities/empty.hpp>
  19. # include <boost/preprocessor/detail/split.hpp>
  20. #
  21. # /* BOOST_PP_IS_EMPTY */
  22. #
  23. # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() && ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()
  24. # define BOOST_PP_IS_EMPTY(x) BOOST_PP_IS_EMPTY_I(x BOOST_PP_IS_EMPTY_HELPER)
  25. # define BOOST_PP_IS_EMPTY_I(contents) BOOST_PP_TUPLE_ELEM(2, 1, (BOOST_PP_IS_EMPTY_DEF_ ## contents()))
  26. # define BOOST_PP_IS_EMPTY_DEF_BOOST_PP_IS_EMPTY_HELPER 1, 1 BOOST_PP_EMPTY
  27. # define BOOST_PP_IS_EMPTY_HELPER() , 0
  28. # else
  29. # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()
  30. # define BOOST_PP_IS_EMPTY(x) BOOST_PP_IS_EMPTY_I(BOOST_PP_IS_EMPTY_HELPER x ())
  31. # 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)))
  32. # define BOOST_PP_IS_EMPTY_II(id) id
  33. # else
  34. # define BOOST_PP_IS_EMPTY(x) BOOST_PP_IS_EMPTY_I((BOOST_PP_IS_EMPTY_HELPER x ()))
  35. # define BOOST_PP_IS_EMPTY_I(par) BOOST_PP_IS_EMPTY_II ## par
  36. # define BOOST_PP_IS_EMPTY_II(test) BOOST_PP_SPLIT(0, BOOST_PP_CAT(BOOST_PP_IS_EMPTY_DEF_, test))
  37. # endif
  38. # define BOOST_PP_IS_EMPTY_HELPER() 1
  39. # define BOOST_PP_IS_EMPTY_DEF_1 1, BOOST_PP_NIL
  40. # define BOOST_PP_IS_EMPTY_DEF_BOOST_PP_IS_EMPTY_HELPER 0, BOOST_PP_NIL
  41. # endif
  42. #
  43. # endif