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_HAS_MEMBER_FUNCTION_HPP)
8 #define BOOST_TTI_HAS_MEMBER_FUNCTION_HPP
10 #include <boost/config.hpp>
11 #include <boost/function_types/property_tags.hpp>
12 #include <boost/mpl/vector.hpp>
13 #include <boost/preprocessor/cat.hpp>
14 #include <boost/tti/detail/ddeftype.hpp>
15 #include <boost/tti/detail/dmem_fun.hpp>
16 #include <boost/tti/gen/has_member_function_gen.hpp>
17 #include <boost/tti/gen/namespace_gen.hpp>
21 The succeeding comments in this file are in doxygen format.
28 /// Expands to a metafunction which tests whether a member function with a particular name and signature exists.
31 trait = the name of the metafunction within the tti namespace.
33 name = the name of the inner member.
35 generates a metafunction called "trait" where 'trait' is the macro parameter.<br />
37 template<class BOOST_TTI_TP_T,class BOOST_TTI_R,class BOOST_TTI_FS,class BOOST_TTI_TAG>
40 static const value = unspecified;
41 typedef mpl::bool_<true-or-false> type;
44 The metafunction types and return:
46 BOOST_TTI_TP_T = the enclosing type in which to look for our 'name'
48 a pointer to member function as a single type.
50 BOOST_TTI_TP_R = (optional) the return type of the member function
51 if the first parameter is the enclosing type.
53 BOOST_TTI_TP_FS = (optional) the parameters of the member function as a boost::mpl forward sequence
54 if the first parameter is the enclosing type and the member function parameters
57 BOOST_TTI_TP_TAG = (optional) a boost::function_types tag to apply to the member function
58 if the first parameter is the enclosing type and a tag is needed.
60 returns = 'value' is true if the 'name' exists,
61 with the appropriate member function type,
62 otherwise 'value' is false.
65 #define BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION(trait,name) \
66 BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_FUNCTION(trait,name) \
67 template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_R = BOOST_TTI_NAMESPACE::detail::deftype,class BOOST_TTI_TP_FS = boost::mpl::vector<>,class BOOST_TTI_TP_TAG = boost::function_types::null_tag> \
71 BOOST_PP_CAT(trait,_detail_hmf)<BOOST_TTI_TP_T,BOOST_TTI_TP_R,BOOST_TTI_TP_FS,BOOST_TTI_TP_TAG>::type type; \
72 BOOST_STATIC_CONSTANT(bool,value=type::value); \
76 /// Expands to a metafunction which tests whether a member function with a particular name and signature exists.
79 name = the name of the inner member.
81 generates a metafunction called "has_member_function_name" where 'name' is the macro parameter.
83 template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_R,class BOOST_TTI_TP_FS,class BOOST_TTI_TP_TAG>
84 struct has_member_function_name
86 static const value = unspecified;
87 typedef mpl::bool_<true-or-false> type;
90 The metafunction types and return:
92 BOOST_TTI_TP_T = the enclosing type in which to look for our 'name'
94 a pointer to member function as a single type.
96 BOOST_TTI_TP_R = (optional) the return type of the member function
97 if the first parameter is the enclosing type.
99 BOOST_TTI_TP_FS = (optional) the parameters of the member function as a boost::mpl forward sequence
100 if the first parameter is the enclosing type and the member function parameters
103 BOOST_TTI_TP_TAG = (optional) a boost::function_types tag to apply to the member function
104 if the first parameter is the enclosing type and a tag is needed.
106 returns = 'value' is true if the 'name' exists,
107 with the appropriate member function type,
108 otherwise 'value' is false.
111 #define BOOST_TTI_HAS_MEMBER_FUNCTION(name) \
112 BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION \
114 BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(name), \
119 #endif // BOOST_TTI_HAS_MEMBER_FUNCTION_HPP