sequence_arity.hpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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_SEQUENCE_ARITY_HPP)
  6. #define BOOST_VMD_DETAIL_SEQUENCE_ARITY_HPP
  7. #include <boost/preprocessor/logical/bitand.hpp>
  8. #include <boost/preprocessor/logical/bitnor.hpp>
  9. #include <boost/preprocessor/tuple/elem.hpp>
  10. #include <boost/vmd/is_empty.hpp>
  11. #include <boost/vmd/detail/modifiers.hpp>
  12. #include <boost/vmd/detail/not_empty.hpp>
  13. #include <boost/vmd/detail/sequence_elem.hpp>
  14. #define BOOST_VMD_DETAIL_IS_MULTI_TUPLE(tuple) \
  15. BOOST_PP_BITNOR \
  16. ( \
  17. BOOST_VMD_IS_EMPTY(BOOST_PP_TUPLE_ELEM(0,tuple)), \
  18. BOOST_VMD_IS_EMPTY(BOOST_PP_TUPLE_ELEM(1,tuple)) \
  19. ) \
  20. /**/
  21. #define BOOST_VMD_DETAIL_IS_UNARY_TUPLE(tuple) \
  22. BOOST_PP_BITAND \
  23. ( \
  24. BOOST_VMD_DETAIL_NOT_EMPTY(BOOST_PP_TUPLE_ELEM(0,tuple)), \
  25. BOOST_VMD_IS_EMPTY(BOOST_PP_TUPLE_ELEM(1,tuple)) \
  26. ) \
  27. /**/
  28. // UNARY
  29. #define BOOST_VMD_DETAIL_IS_UNARY(vseq) \
  30. BOOST_VMD_DETAIL_IS_UNARY_TUPLE \
  31. ( \
  32. BOOST_VMD_DETAIL_SEQUENCE_ELEM(BOOST_VMD_ALLOW_AFTER,0,vseq,BOOST_VMD_RETURN_AFTER) \
  33. ) \
  34. /**/
  35. #define BOOST_VMD_DETAIL_IS_UNARY_D(d,vseq) \
  36. BOOST_VMD_DETAIL_IS_UNARY_TUPLE \
  37. ( \
  38. BOOST_VMD_DETAIL_SEQUENCE_ELEM_D(d,BOOST_VMD_ALLOW_AFTER,0,vseq,BOOST_VMD_RETURN_AFTER) \
  39. ) \
  40. /**/
  41. // MULTI
  42. #define BOOST_VMD_DETAIL_IS_MULTI(vseq) \
  43. BOOST_VMD_DETAIL_IS_MULTI_TUPLE \
  44. ( \
  45. BOOST_VMD_DETAIL_SEQUENCE_ELEM(BOOST_VMD_ALLOW_AFTER,0,vseq,BOOST_VMD_RETURN_AFTER) \
  46. ) \
  47. /**/
  48. #define BOOST_VMD_DETAIL_IS_MULTI_D(d,vseq) \
  49. BOOST_VMD_DETAIL_IS_MULTI_TUPLE \
  50. ( \
  51. BOOST_VMD_DETAIL_SEQUENCE_ELEM_D(d,BOOST_VMD_ALLOW_AFTER,0,vseq,BOOST_VMD_RETURN_AFTER) \
  52. ) \
  53. /**/
  54. #endif /* BOOST_VMD_DETAIL_SEQUENCE_ARITY_HPP */