1 2 // (C) Copyright Edward Diener 2019 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_STATIC_MEM_FUN_TEMPLATE_HPP) 8 #define BOOST_TTI_STATIC_MEM_FUN_TEMPLATE_HPP 9 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/gen/namespace_gen.hpp> 15 #include <boost/tti/gen/has_static_member_function_template_gen.hpp> 16 #include <boost/tti/detail/dstatic_mem_fun_template.hpp> 17 18 #if BOOST_PP_VARIADICS 19 20 #include <boost/tti/detail/dmacro_fun_template.hpp> 21 22 /* 23 24 The succeeding comments in this file are in doxygen format. 25 26 */ 27 28 /** \file 29 */ 30 31 /// A macro which expands to a metafunction which tests whether an inner static member function template with a particular name exists. 32 /** 33 34 BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE is a macro which expands to a metafunction. 35 The metafunction tests whether an inner static member function template with a particular name exists. 36 The macro takes the form of BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(trait,name,...) where 37 38 trait = the name of the metafunction <br/> 39 name = inner static member function template name <br/> 40 ... = variadic parameters. 41 42 The variadic parameter(s) are either: 43 44 A sequence of valid instantiations for the static member function template parameters 45 ie. 'int,long,double' etc. 46 47 or 48 49 A single variadic parameter which is a Boost PP array whose elements are 50 a sequence of valid instantiations for the static member function template parameters 51 ie. '(3,(int,long,double))' etc. This form is allowed in order to be compatible 52 with using the non-variadic form of this macro. 53 54 BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE generates a metafunction called "trait" where 'trait' is the first macro parameter. 55 56 @code 57 58 template<class BOOST_TTI_TP_T,class BOOST_TTI_R,class BOOST_TTI_FS,class BOOST_TTI_TAG> 59 struct trait 60 { 61 static const value = unspecified; 62 typedef mpl::bool_<true-or-false> type; 63 }; 64 65 The metafunction types and return: 66 67 BOOST_TTI_TP_T = the enclosing type in which to look for our 'name'. 68 The enclosing type can be a class, struct, or union. 69 70 BOOST_TTI_TP_R = the return type of the static member function template 71 in a single instantiation of the static member function template 72 OR 73 a pointer to function as a single type 74 which encapsulates a single instantiation of 75 the static member function template. 76 77 BOOST_TTI_TP_FS = (optional) the parameters of the static member function template as a boost::mpl forward sequence 78 if the second parameter is the enclosing type and the static member function template parameters 79 are not empty. These parameters are a single instantiation of the static member function template. 80 81 BOOST_TTI_TP_TAG = (optional) a boost::function_types tag to apply to the static member function template 82 if the second parameter is the enclosing type and a tag is needed. 83 84 returns = 'value' is true if the 'name' exists, 85 with the appropriate static member function template type, 86 otherwise 'value' is false. 87 88 @endcode 89 90 */ 91 #define BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(trait,name,...) \ 92 BOOST_TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE \ 93 ( \ 94 trait, \ 95 name, \ 96 BOOST_TTI_DETAIL_FUN_TEMPLATE_VARIADIC_TO_ARRAY(__VA_ARGS__) \ 97 ) \ 98 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> \ 99 struct trait \ 100 { \ 101 typedef typename \ 102 BOOST_PP_CAT(trait,_detail_hsmft)<BOOST_TTI_TP_T,BOOST_TTI_TP_R,BOOST_TTI_TP_FS,BOOST_TTI_TP_TAG>::type type; \ 103 BOOST_STATIC_CONSTANT(bool,value=type::value); \ 104 }; \ 105 /**/ 106 107 108 /// A macro which expands to a metafunction which tests whether an inner static member function template with a particular name exists. 109 /** 110 111 BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE is a macro which expands to a metafunction. 112 The metafunction tests whether an inner static member function template with a particular name exists. 113 The macro takes the form of BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(name,...) where 114 115 name = inner static member function template name <br/> 116 ... = variadic parameters. 117 118 The variadic parameter(s) are either: 119 120 A sequence of valid instantiations for the static member function template parameters 121 ie. 'int,long,double' etc. 122 123 or 124 125 A single variadic parameter which is a Boost PP array whose elements are 126 a sequence of valid instantiations for the static member function template parameters 127 ie. '(3,(int,long,double))' etc. This form is allowed in order to be compatible 128 with using the non-variadic form of this macro. 129 130 BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE generates a metafunction called "has_static_member_function_template_'name'" where 'name' is the first macro parameter. 131 132 @code 133 134 template<class BOOST_TTI_TP_T,class BOOST_TTI_R,class BOOST_TTI_FS,class BOOST_TTI_TAG> 135 struct has_static_member_function_template_'name' 136 { 137 static const value = unspecified; 138 typedef mpl::bool_<true-or-false> type; 139 }; 140 141 The metafunction types and return: 142 143 BOOST_TTI_TP_T = the enclosing type in which to look for our 'name'. 144 The enclosing type can be a class, struct, or union. 145 146 BOOST_TTI_TP_R = the return type of the static member function template 147 in a single instantiation of the static member function template 148 OR 149 a pointer to function as a single type 150 which encapsulates a single instantiation of 151 the static member function template. 152 153 BOOST_TTI_TP_FS = (optional) the parameters of the static member function template as a boost::mpl forward sequence 154 if the second parameter is the enclosing type and the static member function template parameters 155 are not empty. These parameters are a single instantiation of the static member function template. 156 157 BOOST_TTI_TP_TAG = (optional) a boost::function_types tag to apply to the static member function template 158 if the second parameter is the enclosing type and a tag is needed. 159 160 returns = 'value' is true if the 'name' exists, 161 with the appropriate static member function template type, 162 otherwise 'value' is false. 163 164 @endcode 165 166 */ 167 #define BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(name,...) \ 168 BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE \ 169 ( \ 170 BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE_GEN(name), \ 171 name, \ 172 __VA_ARGS__ \ 173 ) \ 174 /**/ 175 176 #else // !BOOST_PP_VARIADICS 177 178 /* 179 180 The succeeding comments in this file are in doxygen format. 181 182 */ 183 184 /** \file 185 */ 186 187 /// A macro which expands to a metafunction which tests whether an inner static member function template with a particular name exists. 188 /** 189 190 BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE is a macro which expands to a metafunction. 191 The metafunction tests whether an inner static member function template with a particular name exists. 192 The macro takes the form of BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(trait,name,pparray) where 193 194 trait = the name of the metafunction <br/> 195 name = inner static member function template name <br/> 196 pparray = a Boost PP array whose elements are a sequence of valid instantiations for 197 the static member function template parameters ie. '(3,(int,long,double))' etc. 198 199 BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE generates a metafunction called "trait" where 'trait' is the first macro parameter. 200 201 @code 202 203 template<class BOOST_TTI_TP_T,class BOOST_TTI_R,class BOOST_TTI_FS,class BOOST_TTI_TAG> 204 struct trait 205 { 206 static const value = unspecified; 207 typedef mpl::bool_<true-or-false> type; 208 }; 209 210 The metafunction types and return: 211 212 BOOST_TTI_TP_T = the enclosing type in which to look for our 'name'. 213 The enclosing type can be a class, struct, or union. 214 215 BOOST_TTI_TP_R = the return type of the static member function template 216 in a single instantiation of the static member function template 217 OR 218 a pointer to function as a single type 219 which encapsulates a single instantiation of 220 the static member function template. 221 222 BOOST_TTI_TP_FS = (optional) the parameters of the static member function template as a boost::mpl forward sequence 223 if the second parameter is the enclosing type and the static member function template parameters 224 are not empty. These parameters are a single instantiation of the static member function template. 225 226 BOOST_TTI_TP_TAG = (optional) a boost::function_types tag to apply to the static member function template 227 if the second parameter is the enclosing type and a tag is needed. 228 229 returns = 'value' is true if the 'name' exists, 230 with the appropriate static member function template type, 231 otherwise 'value' is false. 232 233 @endcode 234 235 */ 236 #define BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(trait,name,pparray) \ 237 BOOST_TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(trait,name,pparray) \ 238 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> \ 239 struct trait \ 240 { \ 241 typedef typename \ 242 BOOST_PP_CAT(trait,_detail_hsmft)<BOOST_TTI_TP_T,BOOST_TTI_TP_R,BOOST_TTI_TP_FS,BOOST_TTI_TP_TAG>::type type; \ 243 BOOST_STATIC_CONSTANT(bool,value=type::value); \ 244 }; \ 245 /**/ 246 247 /// A macro which expands to a metafunction which tests whether an inner static member function template with a particular name exists. 248 /** 249 250 BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE is a macro which expands to a metafunction. 251 The metafunction tests whether an inner static member function template with a particular name exists. 252 The macro takes the form of BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(name,pparray) where 253 254 name = inner static member function template name <br/> 255 pparray = a Boost PP array whose elements are a sequence of valid instantiations for 256 the static member function template parameters ie. '(3,(int,long,double))' etc. 257 258 BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE generates a metafunction called "has_static_member_function_template_'name'" where 'name' is the first macro parameter. 259 260 @code 261 262 template<class BOOST_TTI_TP_T,class BOOST_TTI_R,class BOOST_TTI_FS,class BOOST_TTI_TAG> 263 struct has_static_member_function_template_'name' 264 { 265 static const value = unspecified; 266 typedef mpl::bool_<true-or-false> type; 267 }; 268 269 The metafunction types and return: 270 271 BOOST_TTI_TP_T = the enclosing type in which to look for our 'name'. 272 The enclosing type can be a class, struct, or union. 273 274 BOOST_TTI_TP_R = the return type of the static member function template 275 in a single instantiation of the static member function template 276 OR 277 a pointer to function as a single type 278 which encapsulates a single instantiation of 279 the static member function template. 280 281 BOOST_TTI_TP_FS = (optional) the parameters of the static member function template as a boost::mpl forward sequence 282 if the second parameter is the enclosing type and the static member function template parameters 283 are not empty. These parameters are a single instantiation of the static member function template. 284 285 BOOST_TTI_TP_TAG = (optional) a boost::function_types tag to apply to the static member function template 286 if the second parameter is the enclosing type and a tag is needed. 287 288 returns = 'value' is true if the 'name' exists, 289 with the appropriate static member function template type, 290 otherwise 'value' is false. 291 292 @endcode 293 294 */ 295 #define BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE(name,pparray) \ 296 BOOST_TTI_TRAIT_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE \ 297 ( \ 298 BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE_GEN(name), \ 299 name, \ 300 pparray \ 301 ) \ 302 /**/ 303 304 #endif // BOOST_PP_VARIADICS 305 306 #endif // BOOST_TTI_STATIC_MEM_FUN_TEMPLATE_HPP 307