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).
7 #if !defined(BOOST_TTI_DETAIL_STATIC_MEM_FUN_HPP)
8 #define BOOST_TTI_DETAIL_STATIC_MEM_FUN_HPP
10 #include <boost/function_types/is_function.hpp>
11 #include <boost/function_types/property_tags.hpp>
12 #include <boost/mpl/and.hpp>
13 #include <boost/mpl/bool.hpp>
14 #include <boost/mpl/eval_if.hpp>
15 #include <boost/mpl/identity.hpp>
16 #include <boost/mpl/vector.hpp>
17 #include <boost/preprocessor/cat.hpp>
18 #include <boost/tti/detail/dnullptr.hpp>
19 #include <boost/tti/detail/dtfunction.hpp>
20 #include <boost/tti/gen/namespace_gen.hpp>
21 #include <boost/type_traits/is_class.hpp>
22 #include <boost/type_traits/is_same.hpp>
23 #include <boost/type_traits/detail/yes_no_type.hpp>
25 #if defined(__SUNPRO_CC)
27 #define BOOST_TTI_DETAIL_TRAIT_IMPL_HAS_STATIC_MEMBER_FUNCTION(trait,name) \
28 template<class BOOST_TTI_DETAIL_TP_T,class BOOST_TTI_DETAIL_TP_TYPE> \
29 struct BOOST_PP_CAT(trait,_detail_ihsmf) \
31 template<BOOST_TTI_DETAIL_TP_TYPE *> \
34 template<class BOOST_TTI_DETAIL_TP_U> \
35 static ::boost::type_traits::yes_type chkt(helper<&BOOST_TTI_DETAIL_TP_U::name> *); \
37 template<class BOOST_TTI_DETAIL_TP_U> \
38 static ::boost::type_traits::no_type chkt(...); \
40 typedef boost::mpl::bool_<sizeof(chkt<BOOST_TTI_DETAIL_TP_T>(BOOST_TTI_DETAIL_NULLPTR))==sizeof(::boost::type_traits::yes_type)> type; \
46 #define BOOST_TTI_DETAIL_TRAIT_IMPL_HAS_STATIC_MEMBER_FUNCTION(trait,name) \
47 template<class BOOST_TTI_DETAIL_TP_T,class BOOST_TTI_DETAIL_TP_TYPE> \
48 struct BOOST_PP_CAT(trait,_detail_ihsmf) \
50 template<BOOST_TTI_DETAIL_TP_TYPE *> \
53 template<class BOOST_TTI_DETAIL_TP_U> \
54 static ::boost::type_traits::yes_type chkt(helper<&BOOST_TTI_DETAIL_TP_U::name> *); \
56 template<class BOOST_TTI_DETAIL_TP_U> \
57 static ::boost::type_traits::no_type chkt(...); \
59 typedef boost::mpl::bool_<sizeof(chkt<BOOST_TTI_DETAIL_TP_T>(BOOST_TTI_DETAIL_NULLPTR))==sizeof(::boost::type_traits::yes_type)> type; \
65 #define BOOST_TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION_OP(trait,name) \
66 BOOST_TTI_DETAIL_TRAIT_IMPL_HAS_STATIC_MEMBER_FUNCTION(trait,name) \
67 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> \
68 struct BOOST_PP_CAT(trait,_detail_hsmf_op) : \
69 BOOST_PP_CAT(trait,_detail_ihsmf) \
71 BOOST_TTI_DETAIL_TP_T, \
77 boost::function_types::is_function<BOOST_TTI_DETAIL_TP_R>, \
78 boost::is_same<BOOST_TTI_DETAIL_TP_FS,boost::mpl::vector<> >, \
79 boost::is_same<BOOST_TTI_DETAIL_TP_TAG,boost::function_types::null_tag> \
81 boost::mpl::identity<BOOST_TTI_DETAIL_TP_R>, \
82 BOOST_TTI_NAMESPACE::detail::tfunction_seq<BOOST_TTI_DETAIL_TP_R,BOOST_TTI_DETAIL_TP_FS,BOOST_TTI_DETAIL_TP_TAG> \
89 #define BOOST_TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION(trait,name) \
90 BOOST_TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION_OP(trait,name) \
91 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> \
92 struct BOOST_PP_CAT(trait,_detail_hsmf) : \
95 boost::is_class<BOOST_TTI_DETAIL_TP_T>, \
96 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>, \
103 #endif // BOOST_TTI_DETAIL_STATIC_MEM_FUN_HPP