]>
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_MEM_FUN_HPP) | |
8 | #define BOOST_TTI_DETAIL_MEM_FUN_HPP | |
9 | ||
7c673cae FG |
10 | #include <boost/function_types/is_member_function_pointer.hpp> |
11 | #include <boost/function_types/property_tags.hpp> | |
12 | #include <boost/mpl/and.hpp> | |
13 | #include <boost/mpl/logical.hpp> | |
14 | #include <boost/mpl/assert.hpp> | |
15 | #include <boost/mpl/bool.hpp> | |
16 | #include <boost/mpl/eval_if.hpp> | |
17 | #include <boost/mpl/vector.hpp> | |
18 | #include <boost/preprocessor/cat.hpp> | |
19 | #include <boost/type_traits/detail/yes_no_type.hpp> | |
7c673cae FG |
20 | #include <boost/type_traits/is_same.hpp> |
21 | #include <boost/type_traits/remove_const.hpp> | |
22 | #include <boost/tti/detail/dcomp_mem_fun.hpp> | |
23 | #include <boost/tti/detail/ddeftype.hpp> | |
f67539c2 | 24 | #include <boost/tti/detail/dmacro_sunfix.hpp> |
7c673cae | 25 | #include <boost/tti/detail/dnullptr.hpp> |
f67539c2 | 26 | #include <boost/tti/detail/denclosing_type.hpp> |
7c673cae FG |
27 | #include <boost/tti/detail/dptmf.hpp> |
28 | #include <boost/tti/gen/namespace_gen.hpp> | |
29 | ||
7c673cae FG |
30 | #define BOOST_TTI_DETAIL_TRAIT_HAS_TYPES_MEMBER_FUNCTION(trait,name) \ |
31 | template<class BOOST_TTI_DETAIL_TP_PMEMF,class BOOST_TTI_DETAIL_TP_C> \ | |
f67539c2 | 32 | struct BOOST_PP_CAT(trait,_detail_hmf_types) \ |
7c673cae FG |
33 | { \ |
34 | template<BOOST_TTI_DETAIL_TP_PMEMF> \ | |
f67539c2 | 35 | struct helper BOOST_TTI_DETAIL_MACRO_SUNFIX ; \ |
7c673cae FG |
36 | \ |
37 | template<class BOOST_TTI_DETAIL_TP_EC> \ | |
38 | static ::boost::type_traits::yes_type chkt(helper<&BOOST_TTI_DETAIL_TP_EC::name> *); \ | |
39 | \ | |
40 | template<class BOOST_TTI_DETAIL_TP_EC> \ | |
41 | static ::boost::type_traits::no_type chkt(...); \ | |
42 | \ | |
43 | typedef boost::mpl::bool_<sizeof(chkt<BOOST_TTI_DETAIL_TP_C>(BOOST_TTI_DETAIL_NULLPTR))==sizeof(::boost::type_traits::yes_type)> type; \ | |
44 | }; \ | |
45 | /**/ | |
46 | ||
7c673cae FG |
47 | #define BOOST_TTI_DETAIL_TRAIT_CTMF_INVOKE(trait,name) \ |
48 | BOOST_TTI_DETAIL_TRAIT_HAS_TYPES_MEMBER_FUNCTION(trait,name) \ | |
49 | 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> \ | |
f67539c2 TL |
50 | struct BOOST_PP_CAT(trait,_detail_hmf_ctmf_invoke) : \ |
51 | BOOST_PP_CAT(trait,_detail_hmf_types) \ | |
7c673cae FG |
52 | < \ |
53 | typename BOOST_TTI_NAMESPACE::detail::ptmf_seq<BOOST_TTI_DETAIL_TP_T,BOOST_TTI_DETAIL_TP_R,BOOST_TTI_DETAIL_TP_FS,BOOST_TTI_DETAIL_TP_TAG>::type, \ | |
54 | BOOST_TTI_DETAIL_TP_T \ | |
55 | > \ | |
56 | { \ | |
57 | }; \ | |
58 | /**/ | |
59 | ||
60 | #define BOOST_TTI_DETAIL_TRAIT_HAS_CALL_TYPES_MEMBER_FUNCTION(trait,name) \ | |
61 | BOOST_TTI_DETAIL_TRAIT_CTMF_INVOKE(trait,name) \ | |
62 | 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> \ | |
f67539c2 | 63 | struct BOOST_PP_CAT(trait,_detail_hmf_call_types) : \ |
92f5a8d4 TL |
64 | boost::mpl::eval_if \ |
65 | < \ | |
f67539c2 TL |
66 | BOOST_TTI_NAMESPACE::detail::enclosing_type<BOOST_TTI_DETAIL_TP_T>, \ |
67 | BOOST_PP_CAT(trait,_detail_hmf_ctmf_invoke) \ | |
92f5a8d4 TL |
68 | < \ |
69 | BOOST_TTI_DETAIL_TP_T, \ | |
70 | BOOST_TTI_DETAIL_TP_R, \ | |
71 | BOOST_TTI_DETAIL_TP_FS, \ | |
72 | BOOST_TTI_DETAIL_TP_TAG \ | |
73 | >, \ | |
74 | boost::mpl::false_ \ | |
75 | > \ | |
7c673cae FG |
76 | { \ |
77 | }; \ | |
78 | /**/ | |
79 | ||
80 | #define BOOST_TTI_DETAIL_TRAIT_CHECK_HAS_COMP_MEMBER_FUNCTION(trait,name) \ | |
81 | BOOST_TTI_DETAIL_TRAIT_HAS_COMP_MEMBER_FUNCTION(trait,name) \ | |
82 | template<class BOOST_TTI_DETAIL_TP_T> \ | |
f67539c2 | 83 | struct BOOST_PP_CAT(trait,_detail_hmf_check_comp) : \ |
7c673cae FG |
84 | BOOST_PP_CAT(trait,_detail_hcmf)<BOOST_TTI_DETAIL_TP_T> \ |
85 | { \ | |
86 | BOOST_MPL_ASSERT((boost::function_types::is_member_function_pointer<BOOST_TTI_DETAIL_TP_T>)); \ | |
87 | }; \ | |
88 | /**/ | |
89 | ||
90 | #define BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_FUNCTION(trait,name) \ | |
91 | BOOST_TTI_DETAIL_TRAIT_HAS_CALL_TYPES_MEMBER_FUNCTION(trait,name) \ | |
92 | BOOST_TTI_DETAIL_TRAIT_CHECK_HAS_COMP_MEMBER_FUNCTION(trait,name) \ | |
93 | 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> \ | |
94 | struct BOOST_PP_CAT(trait,_detail_hmf) : \ | |
95 | boost::mpl::eval_if \ | |
96 | < \ | |
97 | boost::mpl::and_ \ | |
98 | < \ | |
99 | boost::is_same<BOOST_TTI_DETAIL_TP_R,BOOST_TTI_NAMESPACE::detail::deftype>, \ | |
100 | boost::is_same<BOOST_TTI_DETAIL_TP_FS,boost::mpl::vector<> >, \ | |
101 | boost::is_same<BOOST_TTI_DETAIL_TP_TAG,boost::function_types::null_tag> \ | |
102 | >, \ | |
f67539c2 TL |
103 | BOOST_PP_CAT(trait,_detail_hmf_check_comp)<BOOST_TTI_DETAIL_TP_T>, \ |
104 | BOOST_PP_CAT(trait,_detail_hmf_call_types)<BOOST_TTI_DETAIL_TP_T,BOOST_TTI_DETAIL_TP_R,BOOST_TTI_DETAIL_TP_FS,BOOST_TTI_DETAIL_TP_TAG> \ | |
7c673cae FG |
105 | > \ |
106 | { \ | |
107 | }; \ | |
108 | /**/ | |
109 | ||
110 | #endif // BOOST_TTI_DETAIL_MEM_FUN_HPP |