is_general_identifier.hpp 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // (C) Copyright Edward Diener 2020
  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_GENERAL_IDENTIFIER_HPP)
  6. #define BOOST_VMD_DETAIL_IS_GENERAL_IDENTIFIER_HPP
  7. #include <boost/preprocessor/comparison/equal.hpp>
  8. #include <boost/preprocessor/control/iif.hpp>
  9. #include <boost/preprocessor/logical/bitor.hpp>
  10. #include <boost/preprocessor/punctuation/is_begin_parens.hpp>
  11. #include <boost/preprocessor/variadic/size.hpp>
  12. #include <boost/preprocessor/variadic/elem.hpp>
  13. #include <boost/vmd/identity.hpp>
  14. #include <boost/vmd/is_empty.hpp>
  15. #include <boost/vmd/detail/identifier_concat.hpp>
  16. #define BOOST_VMD_DETAIL_IS_GENERAL_IDENTIFIER_VSEQ_RESULT(ignored) \
  17. BOOST_VMD_IDENTITY_RESULT \
  18. ( \
  19. BOOST_VMD_IDENTITY(1)(ignored) \
  20. ) \
  21. /**/
  22. #define BOOST_VMD_DETAIL_IS_GENERAL_IDENTIFIER_VSEQ_ID(vseq) \
  23. BOOST_VMD_DETAIL_IS_GENERAL_IDENTIFIER_VSEQ_RESULT(BOOST_VMD_DETAIL_IDENTIFIER_CONCATENATE(vseq)) \
  24. /**/
  25. #define BOOST_VMD_DETAIL_IS_GENERAL_IDENTIFIER_VSEQ(vseq) \
  26. BOOST_VMD_IDENTITY_RESULT \
  27. ( \
  28. BOOST_PP_IIF \
  29. ( \
  30. BOOST_PP_BITOR \
  31. ( \
  32. BOOST_VMD_IS_EMPTY(vseq), \
  33. BOOST_PP_IS_BEGIN_PARENS(vseq) \
  34. ), \
  35. BOOST_VMD_IDENTITY(0), \
  36. BOOST_VMD_DETAIL_IS_GENERAL_IDENTIFIER_VSEQ_ID \
  37. ) \
  38. (vseq) \
  39. ) \
  40. /**/
  41. #define BOOST_VMD_DETAIL_IS_GENERAL_IDENTIFIER_SINGLE(...) \
  42. BOOST_VMD_DETAIL_IS_GENERAL_IDENTIFIER_VSEQ(BOOST_PP_VARIADIC_ELEM(0,__VA_ARGS__)) \
  43. /**/
  44. #define BOOST_VMD_DETAIL_IS_GENERAL_IDENTIFIER(...) \
  45. BOOST_VMD_IDENTITY_RESULT \
  46. ( \
  47. BOOST_PP_IIF \
  48. ( \
  49. BOOST_PP_EQUAL(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__),1), \
  50. BOOST_VMD_DETAIL_IS_GENERAL_IDENTIFIER_SINGLE, \
  51. BOOST_VMD_IDENTITY(0) \
  52. ) \
  53. (__VA_ARGS__) \
  54. ) \
  55. /**/
  56. #endif /* BOOST_VMD_DETAIL_IS_GENERAL_IDENTIFIER_HPP */