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