1[/ 2 (C) Copyright Edward Diener 2011,2012 3 Distributed under the Boost Software License, Version 1.0. 4 (See accompanying file LICENSE_1_0.txt or copy at 5 http://www.boost.org/LICENSE_1_0.txt). 6] 7 8[section:tti_detail Macro Metafunctions] 9 10The TTI library uses macros to create metafunctions, in the current scope, 11for introspecting an inner element by name. Each macro for a particular type of inner 12element has two forms, the simple one where the first macro parameter designating the 13'name' of the inner element is used to create the name of the metafunction, and the 14complex one where the first macro parameter, called 'trait', designates 15the name of the metafunction and the second macro parameter designates the 'name' to be 16introspected. Other than that difference, the two forms of the macro create metafunctions 17which have the exact same functionality. 18 19To use these metafunctions you can include the main general header file 'boost/tti/tti.hpp', 20unless otherwise noted. Alternatively you can include a specific header file as 21given in the table below. 22 23A table of these macros is given, based on the inner element whose 24existence the metaprogrammer is introspecting. More detailed explanations 25and examples for each of the macro metafunctions will follow this 26section in the documentation. The actual syntax for each macro metafunction 27can be found in the reference section, and examples of usage for all the 28macro metafunctions can be found in the 29[link sectti_usingMM "Using the Macro Metafunctions"] section. 30 31In the Template column below only the name generated by the simple form 32of the template is given since the name generated by the complex form is always 'trait' 33where 'trait' is the first parameter to the corresponding complex form macro. 34 35All of the introspecting metafunctions in the table below return a boolean constant 36called 'value', which specifies whether or not the inner element exists. All of the 37metafunctions also have a nested type called 'type', which for each one is the type 38of the boolean constant value. This is always boost::mpl::bool_. 39 40[table:tbmacros TTI Macro Metafunctions 41 [ 42 [Inner Element] 43 [Macro] 44 [Template] 45 [Specific Header File] 46 ] 47 [ 48 [Type] 49 [ 50 [macroref BOOST_TTI_HAS_TYPE](name) 51 ] 52 [ 53 `has_type_'name'` 54 55 class BOOST_TTI_T = enclosing type 56 57 class BOOST_TTI_U = (optional) MPL lambda expression invoked with the inner type and returning a boolean constant 58 ] 59 [[headerref boost/tti/has_type.hpp `has_type.hpp`]] 60 ] 61 [ 62 [Class/Struct] 63 [ 64 [macroref BOOST_TTI_HAS_CLASS](name) 65 ] 66 [ 67 `has_class_'name'` 68 69 class BOOST_TTI_T = enclosing type 70 71 class BOOST_TTI_U = (optional) MPL lambda expression invoked with the inner class/struct and returning a boolean constant 72 ] 73 [[headerref boost/tti/has_class.hpp `has_class.hpp`]] 74 ] 75 [ 76 [Enumeration] 77 [ 78 [macroref BOOST_TTI_HAS_ENUM](name) 79 ] 80 [ 81 `has_enum_'name'` 82 83 class BOOST_TTI_T = enclosing type 84 85 class BOOST_TTI_U = (optional) MPL lambda expression invoked with the inner enum and returning a boolean constant 86 ] 87 [[headerref boost/tti/has_enum.hpp `has_enum.hpp`]] 88 ] 89 [ 90 [Union] 91 [ 92 [macroref BOOST_TTI_HAS_UNION](name) 93 ] 94 [ 95 `has_union_'name'` 96 97 class BOOST_TTI_T = enclosing type 98 99 class BOOST_TTI_U = (optional) MPL lambda expression invoked with the inner union and returning a boolean constant 100 ] 101 [[headerref boost/tti/has_union.hpp `has_union.hpp`]] 102 ] 103 [ 104 [Class Template] 105 [ 106 Using variadic macros: 107 108 [macroref BOOST_TTI_HAS_TEMPLATE](name) 109 110 Not using variadic macros: 111 112 [macroref BOOST_TTI_HAS_TEMPLATE](name,BOOST_PP_NIL) 113 ] 114 [ 115 `has_template_'name'` 116 117 class BOOST_TTI_T = enclosing type 118 119 All of the template parameters must be template type parameters ( 'class' or 'typename' parameters ) 120 ] 121 [[headerref boost/tti/has_template.hpp `has_template.hpp`]] 122 ] 123 [ 124 [Class Template with params] 125 [ 126 Using variadic macros: 127 128 [macroref BOOST_TTI_HAS_TEMPLATE](name,...[footnote The template parameters as variadic data.]) 129 130 Not using variadic macros: 131 132 [macroref BOOST_TTI_HAS_TEMPLATE](name,ppArray[footnote The template parameters as the tuple part of a Boost PP array.]) 133 ] 134 [ 135 `has_template_'name'` 136 137 class BOOST_TTI_T = enclosing type 138 ] 139 [[headerref boost/tti/has_template.hpp `has_template.hpp`]] 140 ] 141 [ 142 [Member data] 143 [ 144 [macroref BOOST_TTI_HAS_MEMBER_DATA](name) 145 ] 146 [ 147 `has_member_data_'name'` 148 149 class BOOST_TTI_T = enclosing type 150 OR 151 pointer to member data ( 'MemberData_Type Enclosing_Type::*' ) 152 153 class BOOST_TTI_R = (optional) data type. 154 If the first parameter is the pointer to member data this must not be specified. 155 ] 156 [[headerref boost/tti/has_member_data.hpp `has_member_data.hpp`]] 157 ] 158 [ 159 [Member function] 160 [ 161 [macroref BOOST_TTI_HAS_MEMBER_FUNCTION](name) 162 ] 163 [ 164 `has_member_function_'name'` 165 166 class BOOST_TTI_T = enclosing type 167 OR 168 pointer to member function 169 ( 'Return_Type (Enclosing_Type::*) ( Zero or more comma-separated parameter types )' ) 170 171 class BOOST_TTI_R = (optional) return type if the first parameter is the enclosing type. 172 If the first parameter is the pointer to member function this must not be specified. 173 174 class BOOST_TTI_FS = (optional) function parameter types as a Boost MPL forward sequence. 175 If the first parameter is the pointer to member function this must not be specified. 176 If there are no function parameters this does not have to be specified. 177 Defaults to boost::mpl::vector<>. 178 179 class BOOST_TTI_TAG = (optional) Boost `function_types` tag type. 180 If the first parameter is the pointer to member function this must not be specified. 181 Defaults to `boost::function_types::null_tag`. 182 ] 183 [[headerref boost/tti/has_member_function.hpp `has_member_function.hpp`]] 184 ] 185 [ 186 [Member function template] 187 [ 188 Using variadic macros: 189 190 [macroref BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE](name,...[footnote The instantiated template parameters as variadic data.]) 191 192 Not using variadic macros: 193 194 [macroref BOOST_TTI_HAS_MEMBER_FUNCTION_TEMPLATE](name,ppArray[footnote The instantiated template parameters as the tuple part of a Boost PP array.]) 195 ] 196 [ 197 `has_member_function_template_'name'` 198 199 class BOOST_TTI_T = enclosing type 200 OR 201 pointer to member function 202 ( 'Instantiated return_type (Enclosing_Type::*) ( Zero or more comma-separated instantiated parameter types )' ) 203 204 class BOOST_TTI_R = (optional) instantiated return type if the first parameter is the enclosing type. 205 If the first parameter is the pointer to member function this must not be specified. 206 207 class BOOST_TTI_FS = (optional) instantiated function parameter types as a Boost MPL forward sequence. 208 If the first parameter is the pointer to member function this must not be specified. 209 If there are no function parameters this does not have to be specified. 210 Defaults to boost::mpl::vector<>. 211 212 class BOOST_TTI_TAG = (optional) Boost `function_types` tag type. 213 If the first parameter is the pointer to member function this must not be specified. 214 Defaults to `boost::function_types::null_tag`. 215 ] 216 [[headerref boost/tti/has_member_function_template.hpp `has_member_function_template.hpp`]] 217 ] 218 [ 219 [Static member data] 220 [ 221 [macroref BOOST_TTI_HAS_STATIC_MEMBER_DATA](name) 222 ] 223 [ 224 `has_static_member_data_'name'` 225 226 class BOOST_TTI_T = enclosing type 227 228 class BOOST_TTI_TYPE = data type 229 ] 230 [[headerref boost/tti/has_static_member_data.hpp `has_static_member_data.hpp`]] 231 ] 232 [ 233 [Static member function] 234 [ 235 [macroref BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION](name) 236 ] 237 [ 238 `has_static_member_function_'name'` 239 240 class BOOST_TTI_T = enclosing type 241 242 class BOOST_TTI_R = return type 243 OR 244 function type ( 'Return_Type (Zero or more comma-separated parameter types)' ) 245 246 class BOOST_TTI_FS = (optional) function parameter types as a Boost MPL forward sequence. 247 If the second parameter is the function type this must not be specified. 248 If there are no function parameters, this does not have to be specified. 249 Defaults to boost::mpl::vector<>. 250 251 class BOOST_TTI_TAG = (optional) Boost `function_types` tag type. 252 If the second parameter is the function type this must not be specified. 253 Defaults to `boost::function_types::null_tag`. 254 ] 255 [[headerref boost/tti/has_static_member_function.hpp `has_static_member_function.hpp`]] 256 ] 257 [ 258 [Static member function template] 259 [ 260 Using variadic macros: 261 262 [macroref BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE](name,...[footnote The instantiated template parameters as variadic data.]) 263 264 Not using variadic macros: 265 266 [macroref BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION_TEMPLATE](name,ppArray[footnote The instantiated template parameters as the tuple part of a Boost PP array.]) 267 ] 268 [ 269 `has_static_member_function_template_'name'` 270 271 class BOOST_TTI_T = enclosing type 272 273 class BOOST_TTI_R = instantiated return type 274 OR 275 function type ( 'Instantiated return_Type (Zero or more comma-separated instantiated parameter types)' ) 276 277 class BOOST_TTI_FS = (optional) instantiated function parameter types as a Boost MPL forward sequence. 278 If the second parameter is the function type this must not be specified. 279 If there are no function parameters, this does not have to be specified. 280 Defaults to boost::mpl::vector<>. 281 282 class BOOST_TTI_TAG = (optional) Boost `function_types` tag type. 283 If the second parameter is the function type this must not be specified. 284 Defaults to `boost::function_types::null_tag`. 285 ] 286 [[headerref boost/tti/has_static_member_function_template.hpp `has_static_member_function_template.hpp`]] 287 ] 288 [ 289 [Data, either member data or static member data] 290 [ 291 [macroref BOOST_TTI_HAS_DATA](name) 292 ] 293 [ 294 `has_data_'name'` 295 296 class BOOST_TTI_T = enclosing type 297 298 class BOOST_TTI_TYPE = data type 299 ] 300 [[headerref boost/tti/has_data.hpp `has_data.hpp`]] 301 ] 302 [ 303 [Function, either member function or static member function] 304 [ 305 [macroref BOOST_TTI_HAS_FUNCTION](name) 306 ] 307 [ 308 `has_function_'name'` 309 310 class BOOST_TTI_T = enclosing type 311 312 class BOOST_TTI_R = return type 313 314 class BOOST_TTI_FS = (optional) function parameter types as a Boost MPL forward sequence. 315 If there are no function parameters, this does not have to be specified. 316 Defaults to boost::mpl::vector<>. 317 318 class BOOST_TTI_TAG = (optional) Boost `function_types` tag type. 319 Defaults to `boost::function_types::null_tag`. 320 ] 321 [[headerref boost/tti/has_function.hpp `has_function.hpp`]] 322 ] 323 [ 324 [Function template, either member function template or static member function template] 325 [ 326 Using variadic macros: 327 328 [macroref BOOST_TTI_HAS_FUNCTION_TEMPLATE](name,...[footnote The instantiated template parameters as variadic data.]) 329 330 Not using variadic macros: 331 332 [macroref BOOST_TTI_HAS_FUNCTION_TEMPLATE](name,ppArray[footnote The instantiated template parameters as the tuple part of a Boost PP array.]) 333 ] 334 [ 335 `has_function_template_'name'` 336 337 class BOOST_TTI_T = enclosing type 338 339 class BOOST_TTI_R = instantiated return type 340 341 class BOOST_TTI_FS = (optional) instantiated function parameter types as a Boost MPL forward sequence. 342 If there are no function parameters, this does not have to be specified. 343 Defaults to boost::mpl::vector<>. 344 345 class BOOST_TTI_TAG = (optional) Boost `function_types` tag type. 346 Defaults to `boost::function_types::null_tag`. 347 ] 348 [[headerref boost/tti/has_function_template.hpp `has_function_template.hpp`]] 349 ] 350] 351 352[endsect] 353