tti_detail.qbk 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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. [section:tti_detail Macro Metafunctions]
  8. The TTI library uses macros to create metafunctions, in the current scope,
  9. for introspecting an inner element by name. Each macro for a particular type of inner
  10. element has two forms, the simple one where the first macro parameter designating the
  11. 'name' of the inner element is used to create the name of the metafunction, and the
  12. complex one where the first macro parameter, called 'trait', designates
  13. the name of the metafunction and the second macro parameter designates the 'name' to be
  14. introspected. Other than that difference, the two forms of the macro create metafunctions
  15. which have the exact same functionality.
  16. To use these metafunctions you can include the main general header file 'boost/tti/tti.hpp',
  17. unless otherwise noted. Alternatively you can include a specific header file as
  18. given in the table below.
  19. A table of these macros is given, based on the inner element whose
  20. existence the metaprogrammer is introspecting. More detailed explanations
  21. and examples for each of the macro metafunctions will follow this
  22. section in the documentation. The actual syntax for each macro metafunction
  23. can be found in the reference section, and examples of usage for all the
  24. macro metafunctions can be found in the
  25. [link sectti_usingMM "Using the Macro Metafunctions"] section.
  26. In the Template column only the name generated by the simple form
  27. of the template is given since the name generated by the complex form is always 'trait'
  28. where 'trait' is the first parameter to the corresponding complex form macro.
  29. All of the introspecting metafunctions in the table below return a boolean constant
  30. called 'value', which specifies whether or not the inner element exists. All of the
  31. metafunctions also have a nested type called 'type', which for each one is the type
  32. of the boolean constant value. This is always boost::mpl::bool_.
  33. [table:tbmacros TTI Macro Metafunctions
  34. [
  35. [Inner Element]
  36. [Macro]
  37. [Template]
  38. [Specific Header File]
  39. ]
  40. [
  41. [Type]
  42. [
  43. [macroref BOOST_TTI_HAS_TYPE](name)
  44. ]
  45. [
  46. `has_type_'name'`
  47. class TTI_T = enclosing type
  48. ]
  49. [[headerref boost/tti/has_type.hpp `has_type.hpp`]]
  50. ]
  51. [
  52. [Type with lambda expression]
  53. [
  54. [macroref BOOST_TTI_HAS_TYPE](name)
  55. ]
  56. [
  57. `has_type_'name'`
  58. class TTI_T = enclosing type
  59. class TTI_U = lambda expression invoked with the inner type and returning a boolean constant
  60. ]
  61. [[headerref boost/tti/has_type.hpp `has_type.hpp`]]
  62. ]
  63. [
  64. [Class Template ( using variadic macros )]
  65. [
  66. [macroref BOOST_TTI_HAS_TEMPLATE](name)
  67. ]
  68. [
  69. `has_template_'name'`
  70. class TTI_T = enclosing type
  71. All of the template parameters must be template type parameters ( 'class' or 'typename' parameters )
  72. ]
  73. [[headerref boost/tti/has_template.hpp `has_template.hpp`]]
  74. ]
  75. [
  76. [Class Template ( not using variadic macros )]
  77. [
  78. [macroref BOOST_TTI_HAS_TEMPLATE](name,BOOST_PP_NIL)
  79. ]
  80. [
  81. `has_template_'name'`
  82. class TTI_T = enclosing type
  83. All of the template parameters must be template type parameters ( 'class' or 'typename' parameters )
  84. ]
  85. [[headerref boost/tti/has_template.hpp `has_template.hpp`]]
  86. ]
  87. [
  88. [Class Template with params ( using variadic macros )]
  89. [
  90. [macroref BOOST_TTI_HAS_TEMPLATE](name,...[footnote The template parameters as variadic data.])
  91. ]
  92. [
  93. `has_template_'name'`
  94. class TTI_T = enclosing type
  95. ]
  96. [[headerref boost/tti/has_template.hpp `has_template.hpp`]]
  97. ]
  98. [
  99. [Class Template with params]
  100. [
  101. [macroref BOOST_TTI_HAS_TEMPLATE](name,ppArray[footnote The template parameters as the tuple part of the PP array.])
  102. ]
  103. [
  104. `has_template_'name'`
  105. class TTI_T = enclosing type
  106. ]
  107. [[headerref boost/tti/has_template.hpp `has_template.hpp`]]
  108. ]
  109. [
  110. [Member data]
  111. [
  112. [macroref BOOST_TTI_HAS_MEMBER_DATA](name)
  113. ]
  114. [
  115. `has_member_data_'name'`
  116. class TTI_T = enclosing type
  117. OR
  118. pointer to member data ( 'MemberData_Type Enclosing_Type::*' )
  119. class TTI_R = (optional) data type.
  120. If the first parameter is the pointer to member data this must not be specified.
  121. ]
  122. [[headerref boost/tti/has_member_data.hpp `has_member_data.hpp`]]
  123. ]
  124. [
  125. [Member function]
  126. [
  127. [macroref BOOST_TTI_HAS_MEMBER_FUNCTION](name)
  128. ]
  129. [
  130. `has_member_function_'name'`
  131. class TTI_T = enclosing type
  132. OR
  133. pointer to member function
  134. ( 'Return_Type Enclosing_Type::* ( Zero or more comma-separated parameter types )' )
  135. class TTI_R = (optional) return type if the first parameter is the enclosing type.
  136. If the first parameter is the pointer to member function this must not be specified.
  137. class TTI_FS = (optional) function parameter types as a Boost MPL forward sequence.
  138. If the first parameter is the pointer to member function this must not be specified.
  139. If there are no function parameters this does not have to be specified.
  140. Defaults to boost::mpl::vector<>.
  141. class TTI_TAG = (optional) Boost `function_types` tag type.
  142. If the first parameter is the pointer to member function this must not be specified.
  143. Defaults to `boost::function_types::null_tag`.
  144. ]
  145. [[headerref boost/tti/has_member_function.hpp `has_member_function.hpp`]]
  146. ]
  147. [
  148. [Static member data]
  149. [
  150. [macroref BOOST_TTI_HAS_STATIC_MEMBER_DATA](name)
  151. ]
  152. [
  153. `has_static_member_data_'name'`
  154. class TTI_T = enclosing type
  155. class TTI_Type = data type
  156. ]
  157. [[headerref boost/tti/has_static_member_data.hpp `has_static_member_data.hpp`]]
  158. ]
  159. [
  160. [Static member function]
  161. [
  162. [macroref BOOST_TTI_HAS_STATIC_MEMBER_FUNCTION](name)
  163. ]
  164. [
  165. `has_static_member_function_'name'`
  166. class TTI_T = enclosing type
  167. class TTI_R = return type
  168. OR
  169. function type ( 'Return_Type (Zero or more comma-separated parameter types)' )
  170. class TTI_FS = (optional) function parameter types as a Boost MPL forward sequence.
  171. If the second parameter is the function type this must not be specified.
  172. If there are no function parameters, this does not have to be specified.
  173. Defaults to boost::mpl::vector<>.
  174. class TTI_TAG = (optional) Boost `function_types` tag type.
  175. If the second parameter is the function type this must not be specified.
  176. Defaults to `boost::function_types::null_tag`.
  177. ]
  178. [[headerref boost/tti/has_static_member_function.hpp `has_static_member_function.hpp`]]
  179. ]
  180. [
  181. [Data, either member data or static member data]
  182. [
  183. [macroref BOOST_TTI_HAS_DATA](name)
  184. ]
  185. [
  186. `has_data_'name'`
  187. class TTI_T = enclosing type
  188. class TTI_Type = data type
  189. ]
  190. [[headerref boost/tti/has_data.hpp `has_data.hpp`]]
  191. ]
  192. [
  193. [Function, either member function or static member function]
  194. [
  195. [macroref BOOST_TTI_HAS_FUNCTION](name)
  196. ]
  197. [
  198. `has_function_'name'`
  199. class TTI_T = enclosing type
  200. class TTI_R = return type
  201. class TTI_FS = (optional) function parameter types as a Boost MPL forward sequence.
  202. If there are no function parameters, this does not have to be specified.
  203. Defaults to boost::mpl::vector<>.
  204. class TTI_TAG = (optional) Boost `function_types` tag type.
  205. Defaults to `boost::function_types::null_tag`.
  206. ]
  207. [[headerref boost/tti/has_function.hpp `has_function.hpp`]]
  208. ]
  209. ]
  210. [endsect]