is_empty_tuple.hpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // (C) Copyright Edward Diener 2011-2015
  2. // Use, modification and distribution are subject to the Boost Software License,
  3. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt).
  5. #if !defined(BOOST_VMD_DETAIL_IS_EMPTY_TUPLE_HPP)
  6. #define BOOST_VMD_DETAIL_IS_EMPTY_TUPLE_HPP
  7. #include <boost/preprocessor/comparison/equal.hpp>
  8. #include <boost/preprocessor/control/iif.hpp>
  9. #include <boost/preprocessor/tuple/elem.hpp>
  10. #include <boost/preprocessor/tuple/size.hpp>
  11. #include <boost/vmd/identity.hpp>
  12. #include <boost/vmd/is_empty.hpp>
  13. #include <boost/vmd/is_tuple.hpp>
  14. #define BOOST_VMD_DETAIL_IS_EMPTY_TUPLE_CEM(tuple) \
  15. BOOST_VMD_IS_EMPTY(BOOST_PP_TUPLE_ELEM(0,tuple)) \
  16. /**/
  17. #define BOOST_VMD_DETAIL_IS_EMPTY_TUPLE_SIZE(tuple) \
  18. BOOST_VMD_IDENTITY_RESULT \
  19. ( \
  20. BOOST_PP_IIF \
  21. ( \
  22. BOOST_PP_EQUAL(BOOST_PP_TUPLE_SIZE(tuple),1), \
  23. BOOST_VMD_DETAIL_IS_EMPTY_TUPLE_CEM, \
  24. BOOST_VMD_IDENTITY(0) \
  25. ) \
  26. (tuple) \
  27. ) \
  28. /**/
  29. #define BOOST_VMD_DETAIL_IS_EMPTY_TUPLE_SIZE_D(d,tuple) \
  30. BOOST_VMD_IDENTITY_RESULT \
  31. ( \
  32. BOOST_PP_IIF \
  33. ( \
  34. BOOST_PP_EQUAL_D(d,BOOST_PP_TUPLE_SIZE(tuple),1), \
  35. BOOST_VMD_DETAIL_IS_EMPTY_TUPLE_CEM, \
  36. BOOST_VMD_IDENTITY(0) \
  37. ) \
  38. (tuple) \
  39. ) \
  40. /**/
  41. #define BOOST_VMD_DETAIL_IS_EMPTY_TUPLE(tuple) \
  42. BOOST_VMD_IDENTITY_RESULT \
  43. ( \
  44. BOOST_PP_IIF \
  45. ( \
  46. BOOST_VMD_IS_TUPLE(tuple), \
  47. BOOST_VMD_DETAIL_IS_EMPTY_TUPLE_SIZE, \
  48. BOOST_VMD_IDENTITY(0) \
  49. ) \
  50. (tuple) \
  51. ) \
  52. /**/
  53. #define BOOST_VMD_DETAIL_IS_EMPTY_TUPLE_D(d,tuple) \
  54. BOOST_VMD_IDENTITY_RESULT \
  55. ( \
  56. BOOST_PP_IIF \
  57. ( \
  58. BOOST_VMD_IS_TUPLE(tuple), \
  59. BOOST_VMD_DETAIL_IS_EMPTY_TUPLE_SIZE_D, \
  60. BOOST_VMD_IDENTITY(0) \
  61. ) \
  62. (d,tuple) \
  63. ) \
  64. /**/
  65. #endif /* BOOST_VMD_DETAIL_IS_EMPTY_TUPLE_HPP */