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