dstatic_mem_fun.hpp 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. // (C) Copyright Edward Diener 2011,2012,2013
  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_HPP)
  6. #define BOOST_TTI_DETAIL_STATIC_MEM_FUN_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/tti/detail/dnullptr.hpp>
  12. #include <boost/tti/detail/dmacro_sunfix.hpp>
  13. #include <boost/tti/detail/dtfunction.hpp>
  14. #include <boost/tti/detail/denclosing_type.hpp>
  15. #include <boost/tti/detail/dstatic_function_tags.hpp>
  16. #include <boost/tti/detail/dstatic_function_type.hpp>
  17. #include <boost/tti/gen/namespace_gen.hpp>
  18. #include <boost/type_traits/detail/yes_no_type.hpp>
  19. #define BOOST_TTI_DETAIL_TRAIT_IMPL_HAS_STATIC_MEMBER_FUNCTION(trait,name) \
  20. template<class BOOST_TTI_DETAIL_TP_T,class BOOST_TTI_DETAIL_TP_TYPE> \
  21. struct BOOST_PP_CAT(trait,_detail_ihsmf) \
  22. { \
  23. template<BOOST_TTI_DETAIL_TP_TYPE *> \
  24. struct helper BOOST_TTI_DETAIL_MACRO_SUNFIX ; \
  25. \
  26. template<class BOOST_TTI_DETAIL_TP_U> \
  27. static ::boost::type_traits::yes_type chkt(helper<&BOOST_TTI_DETAIL_TP_U::name> *); \
  28. \
  29. template<class BOOST_TTI_DETAIL_TP_U> \
  30. static ::boost::type_traits::no_type chkt(...); \
  31. \
  32. typedef boost::mpl::bool_<sizeof(chkt<BOOST_TTI_DETAIL_TP_T>(BOOST_TTI_DETAIL_NULLPTR))==sizeof(::boost::type_traits::yes_type)> type; \
  33. }; \
  34. /**/
  35. #define BOOST_TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEST_FUNC_CALL(trait,name) \
  36. 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> \
  37. struct BOOST_PP_CAT(trait,_detail_hsmf_ttc) : \
  38. BOOST_PP_CAT(trait,_detail_ihsmf) \
  39. < \
  40. BOOST_TTI_DETAIL_TP_T, \
  41. typename BOOST_TTI_NAMESPACE::detail::tfunction_seq<BOOST_TTI_DETAIL_TP_R,BOOST_TTI_DETAIL_TP_FS,BOOST_TTI_DETAIL_TP_TAG>::type \
  42. > \
  43. { \
  44. }; \
  45. /**/
  46. #define BOOST_TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEST_FUNC(trait,name) \
  47. BOOST_TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEST_FUNC_CALL(trait,name) \
  48. 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> \
  49. struct BOOST_PP_CAT(trait,_detail_hsmf_tt) : \
  50. boost::mpl::eval_if \
  51. < \
  52. BOOST_TTI_NAMESPACE::detail::static_function_tag<BOOST_TTI_DETAIL_TP_TAG>, \
  53. BOOST_PP_CAT(trait,_detail_hsmf_ttc)<BOOST_TTI_DETAIL_TP_T,BOOST_TTI_DETAIL_TP_R,BOOST_TTI_DETAIL_TP_FS,BOOST_TTI_DETAIL_TP_TAG>, \
  54. boost::mpl::false_ \
  55. > \
  56. { \
  57. }; \
  58. /**/
  59. #define BOOST_TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION_OP(trait,name) \
  60. BOOST_TTI_DETAIL_TRAIT_IMPL_HAS_STATIC_MEMBER_FUNCTION(trait,name) \
  61. BOOST_TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEST_FUNC(trait,name) \
  62. 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> \
  63. struct BOOST_PP_CAT(trait,_detail_hsmf_op) : \
  64. boost::mpl::eval_if \
  65. < \
  66. BOOST_TTI_NAMESPACE::detail::static_function_type<BOOST_TTI_DETAIL_TP_R,BOOST_TTI_DETAIL_TP_FS,BOOST_TTI_DETAIL_TP_TAG>, \
  67. BOOST_PP_CAT(trait,_detail_ihsmf)<BOOST_TTI_DETAIL_TP_T,BOOST_TTI_DETAIL_TP_R>, \
  68. BOOST_PP_CAT(trait,_detail_hsmf_tt)<BOOST_TTI_DETAIL_TP_T,BOOST_TTI_DETAIL_TP_R,BOOST_TTI_DETAIL_TP_FS,BOOST_TTI_DETAIL_TP_TAG> \
  69. > \
  70. { \
  71. }; \
  72. /**/
  73. #define BOOST_TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION(trait,name) \
  74. BOOST_TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION_OP(trait,name) \
  75. 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> \
  76. struct BOOST_PP_CAT(trait,_detail_hsmf) : \
  77. boost::mpl::eval_if \
  78. < \
  79. BOOST_TTI_NAMESPACE::detail::enclosing_type<BOOST_TTI_DETAIL_TP_T>, \
  80. BOOST_PP_CAT(trait,_detail_hsmf_op)<BOOST_TTI_DETAIL_TP_T,BOOST_TTI_DETAIL_TP_R,BOOST_TTI_DETAIL_TP_FS,BOOST_TTI_DETAIL_TP_TAG>, \
  81. boost::mpl::false_ \
  82. > \
  83. { \
  84. }; \
  85. /**/
  86. #endif // BOOST_TTI_DETAIL_STATIC_MEM_FUN_HPP