is_empty.hpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # /* **************************************************************************
  2. # * *
  3. # * (C) Copyright Edward Diener 2015.
  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_SEQ_DETAIL_IS_EMPTY_HPP
  13. # define BOOST_PREPROCESSOR_SEQ_DETAIL_IS_EMPTY_HPP
  14. #
  15. # include <boost/preprocessor/config/config.hpp>
  16. # include <boost/preprocessor/arithmetic/dec.hpp>
  17. # include <boost/preprocessor/logical/bool.hpp>
  18. # include <boost/preprocessor/logical/compl.hpp>
  19. # include <boost/preprocessor/seq/size.hpp>
  20. #
  21. /* An empty seq is one that is just BOOST_PP_SEQ_NIL */
  22. #
  23. # define BOOST_PP_SEQ_DETAIL_IS_EMPTY(seq) \
  24. BOOST_PP_COMPL \
  25. ( \
  26. BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY(seq) \
  27. ) \
  28. /**/
  29. #
  30. # define BOOST_PP_SEQ_DETAIL_IS_EMPTY_SIZE(size) \
  31. BOOST_PP_COMPL \
  32. ( \
  33. BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY_SIZE(size) \
  34. ) \
  35. /**/
  36. #
  37. # define BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY(seq) \
  38. BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY_SIZE(BOOST_PP_SEQ_DETAIL_EMPTY_SIZE(seq)) \
  39. /**/
  40. #
  41. # define BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY_SIZE(size) \
  42. BOOST_PP_BOOL(size) \
  43. /**/
  44. #
  45. # define BOOST_PP_SEQ_DETAIL_EMPTY_SIZE(seq) \
  46. BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq (nil))) \
  47. /**/
  48. #
  49. # endif