1 2 // (C) Copyright Edward Diener 2011,2012,2013 3 // Use, modification and distribution are subject to the Boost Software License, 4 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 5 // http://www.boost.org/LICENSE_1_0.txt). 6 7 #if !defined(BOOST_TTI_DETAIL_STATIC_MEM_FUN_HPP) 8 #define BOOST_TTI_DETAIL_STATIC_MEM_FUN_HPP 9 10 #include <boost/mpl/bool.hpp> 11 #include <boost/mpl/eval_if.hpp> 12 #include <boost/mpl/identity.hpp> 13 #include <boost/preprocessor/cat.hpp> 14 #include <boost/tti/detail/dnullptr.hpp> 15 #include <boost/tti/detail/dmacro_sunfix.hpp> 16 #include <boost/tti/detail/dtfunction.hpp> 17 #include <boost/tti/detail/denclosing_type.hpp> 18 #include <boost/tti/detail/dstatic_function_tags.hpp> 19 #include <boost/tti/detail/dstatic_function_type.hpp> 20 #include <boost/tti/gen/namespace_gen.hpp> 21 #include <boost/type_traits/detail/yes_no_type.hpp> 22 23 #define BOOST_TTI_DETAIL_TRAIT_IMPL_HAS_STATIC_MEMBER_FUNCTION(trait,name) \ 24 template<class BOOST_TTI_DETAIL_TP_T,class BOOST_TTI_DETAIL_TP_TYPE> \ 25 struct BOOST_PP_CAT(trait,_detail_ihsmf) \ 26 { \ 27 template<BOOST_TTI_DETAIL_TP_TYPE *> \ 28 struct helper BOOST_TTI_DETAIL_MACRO_SUNFIX ; \ 29 \ 30 template<class BOOST_TTI_DETAIL_TP_U> \ 31 static ::boost::type_traits::yes_type chkt(helper<&BOOST_TTI_DETAIL_TP_U::name> *); \ 32 \ 33 template<class BOOST_TTI_DETAIL_TP_U> \ 34 static ::boost::type_traits::no_type chkt(...); \ 35 \ 36 typedef boost::mpl::bool_<sizeof(chkt<BOOST_TTI_DETAIL_TP_T>(BOOST_TTI_DETAIL_NULLPTR))==sizeof(::boost::type_traits::yes_type)> type; \ 37 }; \ 38 /**/ 39 40 #define BOOST_TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEST_FUNC_CALL(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_ttc) : \ 43 BOOST_PP_CAT(trait,_detail_ihsmf) \ 44 < \ 45 BOOST_TTI_DETAIL_TP_T, \ 46 typename BOOST_TTI_NAMESPACE::detail::tfunction_seq<BOOST_TTI_DETAIL_TP_R,BOOST_TTI_DETAIL_TP_FS,BOOST_TTI_DETAIL_TP_TAG>::type \ 47 > \ 48 { \ 49 }; \ 50 /**/ 51 52 #define BOOST_TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEST_FUNC(trait,name) \ 53 BOOST_TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEST_FUNC_CALL(trait,name) \ 54 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> \ 55 struct BOOST_PP_CAT(trait,_detail_hsmf_tt) : \ 56 boost::mpl::eval_if \ 57 < \ 58 BOOST_TTI_NAMESPACE::detail::static_function_tag<BOOST_TTI_DETAIL_TP_TAG>, \ 59 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>, \ 60 boost::mpl::false_ \ 61 > \ 62 { \ 63 }; \ 64 /**/ 65 66 #define BOOST_TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION_OP(trait,name) \ 67 BOOST_TTI_DETAIL_TRAIT_IMPL_HAS_STATIC_MEMBER_FUNCTION(trait,name) \ 68 BOOST_TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEST_FUNC(trait,name) \ 69 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> \ 70 struct BOOST_PP_CAT(trait,_detail_hsmf_op) : \ 71 boost::mpl::eval_if \ 72 < \ 73 BOOST_TTI_NAMESPACE::detail::static_function_type<BOOST_TTI_DETAIL_TP_R,BOOST_TTI_DETAIL_TP_FS,BOOST_TTI_DETAIL_TP_TAG>, \ 74 BOOST_PP_CAT(trait,_detail_ihsmf)<BOOST_TTI_DETAIL_TP_T,BOOST_TTI_DETAIL_TP_R>, \ 75 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> \ 76 > \ 77 { \ 78 }; \ 79 /**/ 80 81 #define BOOST_TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION(trait,name) \ 82 BOOST_TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION_OP(trait,name) \ 83 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> \ 84 struct BOOST_PP_CAT(trait,_detail_hsmf) : \ 85 boost::mpl::eval_if \ 86 < \ 87 BOOST_TTI_NAMESPACE::detail::enclosing_type<BOOST_TTI_DETAIL_TP_T>, \ 88 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>, \ 89 boost::mpl::false_ \ 90 > \ 91 { \ 92 }; \ 93 /**/ 94 95 #endif // BOOST_TTI_DETAIL_STATIC_MEM_FUN_HPP 96