]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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/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> | |
24 | ||
25 | #if defined(__SUNPRO_CC) | |
26 | ||
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) \ | |
30 | { \ | |
31 | template<BOOST_TTI_DETAIL_TP_TYPE *> \ | |
32 | struct helper {}; \ | |
33 | \ | |
34 | template<class BOOST_TTI_DETAIL_TP_U> \ | |
35 | static ::boost::type_traits::yes_type chkt(helper<&BOOST_TTI_DETAIL_TP_U::name> *); \ | |
36 | \ | |
37 | template<class BOOST_TTI_DETAIL_TP_U> \ | |
38 | static ::boost::type_traits::no_type chkt(...); \ | |
39 | \ | |
40 | typedef boost::mpl::bool_<sizeof(chkt<BOOST_TTI_DETAIL_TP_T>(BOOST_TTI_DETAIL_NULLPTR))==sizeof(::boost::type_traits::yes_type)> type; \ | |
41 | }; \ | |
42 | /**/ | |
43 | ||
44 | #else | |
45 | ||
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) \ | |
49 | { \ | |
50 | template<BOOST_TTI_DETAIL_TP_TYPE *> \ | |
51 | struct helper; \ | |
52 | \ | |
53 | template<class BOOST_TTI_DETAIL_TP_U> \ | |
54 | static ::boost::type_traits::yes_type chkt(helper<&BOOST_TTI_DETAIL_TP_U::name> *); \ | |
55 | \ | |
56 | template<class BOOST_TTI_DETAIL_TP_U> \ | |
57 | static ::boost::type_traits::no_type chkt(...); \ | |
58 | \ | |
59 | typedef boost::mpl::bool_<sizeof(chkt<BOOST_TTI_DETAIL_TP_T>(BOOST_TTI_DETAIL_NULLPTR))==sizeof(::boost::type_traits::yes_type)> type; \ | |
60 | }; \ | |
61 | /**/ | |
62 | ||
63 | #endif | |
64 | ||
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) \ | |
70 | < \ | |
71 | BOOST_TTI_DETAIL_TP_T, \ | |
72 | typename \ | |
73 | boost::mpl::eval_if \ | |
74 | < \ | |
75 | boost::mpl::and_ \ | |
76 | < \ | |
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> \ | |
80 | >, \ | |
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> \ | |
83 | >::type \ | |
84 | > \ | |
85 | { \ | |
86 | }; \ | |
87 | /**/ | |
88 | ||
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) : \ | |
93 | boost::mpl::eval_if \ | |
94 | < \ | |
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>, \ | |
97 | boost::mpl::false_ \ | |
98 | > \ | |
99 | { \ | |
100 | }; \ | |
101 | /**/ | |
102 | ||
103 | #endif // BOOST_TTI_DETAIL_STATIC_MEM_FUN_HPP |