dstatic_mem_fun.hpp 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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/config.hpp>
  8. #include <boost/function_types/is_function.hpp>
  9. #include <boost/function_types/property_tags.hpp>
  10. #include <boost/mpl/and.hpp>
  11. #include <boost/mpl/bool.hpp>
  12. #include <boost/mpl/eval_if.hpp>
  13. #include <boost/mpl/identity.hpp>
  14. #include <boost/mpl/vector.hpp>
  15. #include <boost/preprocessor/cat.hpp>
  16. #include <boost/tti/detail/dnullptr.hpp>
  17. #include <boost/tti/detail/dtfunction.hpp>
  18. #include <boost/tti/gen/namespace_gen.hpp>
  19. #include <boost/type_traits/detail/yes_no_type.hpp>
  20. #include <boost/type_traits/is_same.hpp>
  21. #define BOOST_TTI_DETAIL_TRAIT_IMPL_HAS_STATIC_MEMBER_FUNCTION(trait,name) \
  22. template<class BOOST_TTI_DETAIL_TP_T,class BOOST_TTI_DETAIL_TP_TYPE> \
  23. struct BOOST_PP_CAT(trait,_detail_ihsmf) \
  24. { \
  25. template<BOOST_TTI_DETAIL_TP_TYPE *> \
  26. struct helper; \
  27. \
  28. template<class BOOST_TTI_DETAIL_TP_U> \
  29. static ::boost::type_traits::yes_type chkt(helper<&BOOST_TTI_DETAIL_TP_U::name> *); \
  30. \
  31. template<class BOOST_TTI_DETAIL_TP_U> \
  32. static ::boost::type_traits::no_type chkt(...); \
  33. \
  34. BOOST_STATIC_CONSTANT(bool,value=sizeof(chkt<BOOST_TTI_DETAIL_TP_T>(BOOST_TTI_DETAIL_NULLPTR))==sizeof(::boost::type_traits::yes_type)); \
  35. \
  36. typedef boost::mpl::bool_<value> type; \
  37. }; \
  38. /**/
  39. #define BOOST_TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION(trait,name) \
  40. BOOST_TTI_DETAIL_TRAIT_IMPL_HAS_STATIC_MEMBER_FUNCTION(trait,name) \
  41. 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> \
  42. struct BOOST_PP_CAT(trait,_detail_hsmf) : \
  43. BOOST_PP_CAT(trait,_detail_ihsmf) \
  44. < \
  45. BOOST_TTI_DETAIL_TP_T, \
  46. typename \
  47. boost::mpl::eval_if \
  48. < \
  49. boost::mpl::and_ \
  50. < \
  51. boost::function_types::is_function<BOOST_TTI_DETAIL_TP_R>, \
  52. boost::is_same<BOOST_TTI_DETAIL_TP_FS,boost::mpl::vector<> >, \
  53. boost::is_same<BOOST_TTI_DETAIL_TP_TAG,boost::function_types::null_tag> \
  54. >, \
  55. boost::mpl::identity<BOOST_TTI_DETAIL_TP_R>, \
  56. BOOST_TTI_NAMESPACE::detail::tfunction_seq<BOOST_TTI_DETAIL_TP_R,BOOST_TTI_DETAIL_TP_FS,BOOST_TTI_DETAIL_TP_TAG> \
  57. >::type \
  58. > \
  59. { \
  60. }; \
  61. /**/
  62. #endif // BOOST_TTI_DETAIL_STATIC_MEM_FUN_HPP