annotate DEPENDENCIES/generic/include/boost/tti/has_member_function.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents c530137014c0
children
rev   line source
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_HAS_MEMBER_FUNCTION_HPP)
Chris@16 8 #define BOOST_TTI_HAS_MEMBER_FUNCTION_HPP
Chris@16 9
Chris@101 10 #include <boost/config.hpp>
Chris@16 11 #include <boost/function_types/property_tags.hpp>
Chris@16 12 #include <boost/mpl/vector.hpp>
Chris@16 13 #include <boost/preprocessor/cat.hpp>
Chris@16 14 #include <boost/tti/detail/ddeftype.hpp>
Chris@16 15 #include <boost/tti/detail/dmem_fun.hpp>
Chris@16 16 #include <boost/tti/gen/has_member_function_gen.hpp>
Chris@16 17 #include <boost/tti/gen/namespace_gen.hpp>
Chris@16 18
Chris@16 19 /*
Chris@16 20
Chris@16 21 The succeeding comments in this file are in doxygen format.
Chris@16 22
Chris@16 23 */
Chris@16 24
Chris@16 25 /** \file
Chris@16 26 */
Chris@16 27
Chris@16 28 /// Expands to a metafunction which tests whether a member function with a particular name and signature exists.
Chris@16 29 /**
Chris@16 30
Chris@16 31 trait = the name of the metafunction within the tti namespace.
Chris@16 32
Chris@16 33 name = the name of the inner member.
Chris@16 34
Chris@16 35 generates a metafunction called "trait" where 'trait' is the macro parameter.<br />
Chris@16 36
Chris@16 37 template<class BOOST_TTI_TP_T,class BOOST_TTI_R,class BOOST_TTI_FS,class BOOST_TTI_TAG>
Chris@16 38 struct trait
Chris@16 39 {
Chris@16 40 static const value = unspecified;
Chris@16 41 typedef mpl::bool_<true-or-false> type;
Chris@16 42 };
Chris@16 43
Chris@16 44 The metafunction types and return:
Chris@16 45
Chris@16 46 BOOST_TTI_TP_T = the enclosing type in which to look for our 'name'
Chris@16 47 OR
Chris@16 48 a pointer to member function as a single type.
Chris@16 49
Chris@16 50 BOOST_TTI_TP_R = (optional) the return type of the member function
Chris@16 51 if the first parameter is the enclosing type.
Chris@16 52
Chris@16 53 BOOST_TTI_TP_FS = (optional) the parameters of the member function as a boost::mpl forward sequence
Chris@16 54 if the first parameter is the enclosing type and the member function parameters
Chris@16 55 are not empty.
Chris@16 56
Chris@16 57 BOOST_TTI_TP_TAG = (optional) a boost::function_types tag to apply to the member function
Chris@16 58 if the first parameter is the enclosing type and a tag is needed.
Chris@16 59
Chris@16 60 returns = 'value' is true if the 'name' exists,
Chris@16 61 with the appropriate member function type,
Chris@16 62 otherwise 'value' is false.
Chris@16 63
Chris@16 64 */
Chris@16 65 #define BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION(trait,name) \
Chris@16 66 BOOST_TTI_DETAIL_TRAIT_HAS_MEMBER_FUNCTION(trait,name) \
Chris@16 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> \
Chris@101 68 struct trait \
Chris@16 69 { \
Chris@101 70 typedef typename \
Chris@101 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; \
Chris@101 72 BOOST_STATIC_CONSTANT(bool,value=type::value); \
Chris@16 73 }; \
Chris@16 74 /**/
Chris@16 75
Chris@16 76 /// Expands to a metafunction which tests whether a member function with a particular name and signature exists.
Chris@16 77 /**
Chris@16 78
Chris@16 79 name = the name of the inner member.
Chris@16 80
Chris@16 81 generates a metafunction called "has_member_function_name" where 'name' is the macro parameter.
Chris@16 82
Chris@16 83 template<class BOOST_TTI_TP_T,class BOOST_TTI_TP_R,class BOOST_TTI_TP_FS,class BOOST_TTI_TP_TAG>
Chris@16 84 struct has_member_function_name
Chris@16 85 {
Chris@16 86 static const value = unspecified;
Chris@16 87 typedef mpl::bool_<true-or-false> type;
Chris@16 88 };
Chris@16 89
Chris@16 90 The metafunction types and return:
Chris@16 91
Chris@16 92 BOOST_TTI_TP_T = the enclosing type in which to look for our 'name'
Chris@16 93 OR
Chris@16 94 a pointer to member function as a single type.
Chris@16 95
Chris@16 96 BOOST_TTI_TP_R = (optional) the return type of the member function
Chris@16 97 if the first parameter is the enclosing type.
Chris@16 98
Chris@16 99 BOOST_TTI_TP_FS = (optional) the parameters of the member function as a boost::mpl forward sequence
Chris@16 100 if the first parameter is the enclosing type and the member function parameters
Chris@16 101 are not empty.
Chris@16 102
Chris@16 103 BOOST_TTI_TP_TAG = (optional) a boost::function_types tag to apply to the member function
Chris@16 104 if the first parameter is the enclosing type and a tag is needed.
Chris@16 105
Chris@16 106 returns = 'value' is true if the 'name' exists,
Chris@16 107 with the appropriate member function type,
Chris@16 108 otherwise 'value' is false.
Chris@16 109
Chris@16 110 */
Chris@16 111 #define BOOST_TTI_HAS_MEMBER_FUNCTION(name) \
Chris@16 112 BOOST_TTI_TRAIT_HAS_MEMBER_FUNCTION \
Chris@16 113 ( \
Chris@16 114 BOOST_TTI_HAS_MEMBER_FUNCTION_GEN(name), \
Chris@16 115 name \
Chris@16 116 ) \
Chris@16 117 /**/
Chris@16 118
Chris@16 119 #endif // BOOST_TTI_HAS_MEMBER_FUNCTION_HPP