2 // (C) Copyright Edward Diener 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_FUNCTION_HPP)
8 #define BOOST_TTI_HAS_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/dfunction.hpp>
15 #include <boost/tti/gen/has_function_gen.hpp>
19 The succeeding comments in this file are in doxygen format.
26 /// Expands to a metafunction which tests whether a member function or a static member function with a particular name and signature exists.
29 trait = the name of the metafunction within the tti namespace.
31 name = the name of the inner member.
33 generates a metafunction called "trait" where 'trait' is the macro parameter.
35 template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_R,class BOOST_TTI_TP_FS,class BOOST_TTI_TP_TAG>
38 static const value = unspecified;
39 typedef mpl::bool_<true-or-false> type;
42 The metafunction types and return:
44 BOOST_TTI_TP_T = the enclosing type in which to look for our 'name'.
46 BOOST_TTI_TP_R = the return type of the function
48 BOOST_TTI_TP_FS = (optional) the parameters of the function as a boost::mpl forward sequence
49 if function parameters are not empty.
51 BOOST_TTI_TP_TAG = (optional) a boost::function_types tag to apply to the function
52 if the need for a tag exists.
54 returns = 'value' is true if the 'name' exists,
55 with the appropriate static member function type,
56 otherwise 'value' is false.
59 #define BOOST_TTI_TRAIT_HAS_FUNCTION(trait,name) \
60 BOOST_TTI_DETAIL_TRAIT_HAS_FUNCTION(trait,name) \
61 template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_R,class BOOST_TTI_TP_FS = boost::mpl::vector<>,class BOOST_TTI_TP_TAG = boost::function_types::null_tag> \
65 BOOST_PP_CAT(trait,_detail_hf)<BOOST_TTI_TP_T,BOOST_TTI_TP_R,BOOST_TTI_TP_FS,BOOST_TTI_TP_TAG>::type type; \
66 BOOST_STATIC_CONSTANT(bool,value=type::value); \
70 /// Expands to a metafunction which tests whether a member function or a static member function with a particular name and signature exists.
73 name = the name of the inner member.
75 generates a metafunction called "has_function_name" where 'name' is the macro parameter.
77 template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_R,class BOOST_TTI_TP_FS,class BOOST_TTI_TP_TAG>
80 static const value = unspecified;
81 typedef mpl::bool_<true-or-false> type;
84 The metafunction types and return:
86 BOOST_TTI_TP_T = the enclosing type in which to look for our 'name'.
88 BOOST_TTI_TP_R = the return type of the function
90 BOOST_TTI_TP_FS = (optional) the parameters of the function as a boost::mpl forward sequence
91 if function parameters are not empty.
93 BOOST_TTI_TP_TAG = (optional) a boost::function_types tag to apply to the function
94 if the need for a tag exists.
96 returns = 'value' is true if the 'name' exists,
97 with the appropriate function type,
98 otherwise 'value' is false.
101 #define BOOST_TTI_HAS_FUNCTION(name) \
102 BOOST_TTI_TRAIT_HAS_FUNCTION \
104 BOOST_TTI_HAS_FUNCTION_GEN(name), \
109 #endif // BOOST_TTI_HAS_FUNCTION_HPP