dstatic_mem_fun_template.hpp 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. // (C) Copyright Edward Diener 2019
  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_TTI_DETAIL_STATIC_MEM_FUN_TEMPLATE_HPP)
  6. #define BOOST_TTI_DETAIL_STATIC_MEM_FUN_TEMPLATE_HPP
  7. #include <boost/mpl/bool.hpp>
  8. #include <boost/mpl/eval_if.hpp>
  9. #include <boost/mpl/identity.hpp>
  10. #include <boost/preprocessor/cat.hpp>
  11. #include <boost/preprocessor/array/enum.hpp>
  12. #include <boost/tti/detail/dmacro_sunfix.hpp>
  13. #include <boost/tti/detail/dnullptr.hpp>
  14. #include <boost/tti/detail/dtfunction.hpp>
  15. #include <boost/tti/detail/denclosing_type.hpp>
  16. #include <boost/tti/detail/dstatic_function_tags.hpp>
  17. #include <boost/tti/detail/dstatic_function_type.hpp>
  18. #include <boost/tti/gen/namespace_gen.hpp>
  19. #include <boost/type_traits/detail/yes_no_type.hpp>
  20. #define BOOST_TTI_DETAIL_TRAIT_IMPL_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(trait,name,pparray) \
  21. template<class BOOST_TTI_DETAIL_TP_T,class BOOST_TTI_DETAIL_TP_TYPE> \
  22. struct BOOST_PP_CAT(trait,_detail_ihsmft) \
  23. { \
  24. template<BOOST_TTI_DETAIL_TP_TYPE *> \
  25. struct helper BOOST_TTI_DETAIL_MACRO_SUNFIX ; \
  26. \
  27. template<class U> \
  28. static ::boost::type_traits::yes_type check(helper<&U::template name<BOOST_PP_ARRAY_ENUM(pparray)> > *); \
  29. \
  30. template<class U> \
  31. static ::boost::type_traits::no_type check(...); \
  32. \
  33. typedef boost::mpl::bool_<sizeof(check<BOOST_TTI_DETAIL_TP_T>(BOOST_TTI_DETAIL_NULLPTR))==sizeof(::boost::type_traits::yes_type)> type; \
  34. }; \
  35. /**/
  36. #define BOOST_TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE_TEST_FUNC_CALL(trait,name,pparray) \
  37. template<class BOOST_TTI_DETAIL_TP_T,class BOOST_TTI_DETAIL_TP_R,class BOOST_TTI_DETAIL_TP_FS,class BOOST_TTI_DETAIL_TP_TAG> \
  38. struct BOOST_PP_CAT(trait,_detail_hsmft_ttc) : \
  39. BOOST_PP_CAT(trait,_detail_ihsmft) \
  40. < \
  41. BOOST_TTI_DETAIL_TP_T, \
  42. typename BOOST_TTI_NAMESPACE::detail::tfunction_seq<BOOST_TTI_DETAIL_TP_R,BOOST_TTI_DETAIL_TP_FS,BOOST_TTI_DETAIL_TP_TAG>::type \
  43. > \
  44. { \
  45. }; \
  46. /**/
  47. #define BOOST_TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE_TEST_FUNC(trait,name,pparray) \
  48. BOOST_TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE_TEST_FUNC_CALL(trait,name,pparray) \
  49. template<class BOOST_TTI_DETAIL_TP_T,class BOOST_TTI_DETAIL_TP_R,class BOOST_TTI_DETAIL_TP_FS,class BOOST_TTI_DETAIL_TP_TAG> \
  50. struct BOOST_PP_CAT(trait,_detail_hsmft_tt) : \
  51. boost::mpl::eval_if \
  52. < \
  53. BOOST_TTI_NAMESPACE::detail::static_function_tag<BOOST_TTI_DETAIL_TP_TAG>, \
  54. BOOST_PP_CAT(trait,_detail_hsmft_ttc)<BOOST_TTI_DETAIL_TP_T,BOOST_TTI_DETAIL_TP_R,BOOST_TTI_DETAIL_TP_FS,BOOST_TTI_DETAIL_TP_TAG>, \
  55. boost::mpl::false_ \
  56. > \
  57. { \
  58. }; \
  59. /**/
  60. #define BOOST_TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE_OP(trait,name,pparray) \
  61. BOOST_TTI_DETAIL_TRAIT_IMPL_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(trait,name,pparray) \
  62. BOOST_TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE_TEST_FUNC(trait,name,pparray) \
  63. template<class BOOST_TTI_DETAIL_TP_T,class BOOST_TTI_DETAIL_TP_R,class BOOST_TTI_DETAIL_TP_FS,class BOOST_TTI_DETAIL_TP_TAG> \
  64. struct BOOST_PP_CAT(trait,_detail_hsmft_op) : \
  65. boost::mpl::eval_if \
  66. < \
  67. BOOST_TTI_NAMESPACE::detail::static_function_type<BOOST_TTI_DETAIL_TP_R,BOOST_TTI_DETAIL_TP_FS,BOOST_TTI_DETAIL_TP_TAG>, \
  68. BOOST_PP_CAT(trait,_detail_ihsmft)<BOOST_TTI_DETAIL_TP_T,BOOST_TTI_DETAIL_TP_R>, \
  69. BOOST_PP_CAT(trait,_detail_hsmft_tt)<BOOST_TTI_DETAIL_TP_T,BOOST_TTI_DETAIL_TP_R,BOOST_TTI_DETAIL_TP_FS,BOOST_TTI_DETAIL_TP_TAG> \
  70. > \
  71. { \
  72. }; \
  73. /**/
  74. #define BOOST_TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(trait,name,pparray) \
  75. BOOST_TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE_OP(trait,name,pparray) \
  76. template<class BOOST_TTI_DETAIL_TP_T,class BOOST_TTI_DETAIL_TP_R,class BOOST_TTI_DETAIL_TP_FS,class BOOST_TTI_DETAIL_TP_TAG> \
  77. struct BOOST_PP_CAT(trait,_detail_hsmft) : \
  78. boost::mpl::eval_if \
  79. < \
  80. BOOST_TTI_NAMESPACE::detail::enclosing_type<BOOST_TTI_DETAIL_TP_T>, \
  81. BOOST_PP_CAT(trait,_detail_hsmft_op)<BOOST_TTI_DETAIL_TP_T,BOOST_TTI_DETAIL_TP_R,BOOST_TTI_DETAIL_TP_FS,BOOST_TTI_DETAIL_TP_TAG>, \
  82. boost::mpl::false_ \
  83. > \
  84. { \
  85. }; \
  86. /**/
  87. #endif // BOOST_TTI_DETAIL_STATIC_MEM_FUN_TEMPLATE_HPP