tti_introduction.qbk 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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_intro Introduction]
  8. Welcome to the Boost Type Traits Introspection library, abbreviated TTI.
  9. TTI is a library which provides the ability to introspect by name the elements
  10. of a type at compile time.
  11. TTI works through macros generating metafunctions. Metafunctions are class
  12. templates of a particular syntax, having a nested 'type' member. So wherever
  13. in C++ class templates can occur, TTI macros can be used. The metafunctions
  14. generated by TTI are no different from any other metafunction as defined by
  15. the Boost MPL library.
  16. The metafunctions generated by TTI are used to introspect elements of a type
  17. at compile time, always passing at minimum to each metafunction the enclosing
  18. type being introspected.
  19. The name of the library has been chosen because the library offers
  20. compile time functionality on a type, similar to the Boost Type Traits library,
  21. and because the functionality the library offers is the ability to introspect
  22. a type about the existence of a specific element within that type.
  23. I use the word "introspect" in a very broad sense here. Normally computer
  24. language introspection means initially asking for information to be returned
  25. by name, which can then further be used to introspect for more specific
  26. information. In the TTI library one must always know and supply the name, and
  27. use the functionality provided for the correct type of inner element to find
  28. out if that particular named entity exists.
  29. You may prefer the term "query" instead of "introspection" to denote what this
  30. library does, but I use terminology based on the word "introspect" throughout
  31. this documentation.
  32. The functionality of the library may be summed up as:
  33. * Provide the means to introspect a type at compile time
  34. using a set of macros. Each macro takes the name of the
  35. type's element and generates a metafunction which can be
  36. subsequently invoked to determine whether or not the
  37. element exists within the type. These generated metafunctions
  38. will be called "macro metafunctions" in the documentation.
  39. * Provide the means to create a typedef for a type which may
  40. not exist. This typedef type can be used as a type in the
  41. metafunctions of the library without producing compile-time
  42. errors.
  43. The library is dependent on Boost PP, Boost MPL,
  44. Boost Type Traits, and Boost Function Types.
  45. The library is also dependent on the variadic macro support
  46. of the Boost PP library if the variadic macros in the library
  47. are used.
  48. The library is a header only library.
  49. Since the dependencies of the library are all header only
  50. libraries, there is no need to build a library in order to use
  51. the TTI library.
  52. [section:tti_headers Header Files]
  53. There are is a single header file, `boost/tti/tti.hpp`,
  54. which includes all the header files in the library.
  55. There are also separate specific header files for each of the elements
  56. to be introspected by the library. This allows for finer-grained inclusion
  57. of the nested elements to be introspected. These header files are:
  58. [table:tbhfiles TTI Header Files
  59. [
  60. [Introspected Element]
  61. [Specific Header File]
  62. ]
  63. [
  64. [Type]
  65. [[headerref boost/tti/has_type.hpp `has_type.hpp`]]
  66. ]
  67. [
  68. [Class Template]
  69. [[headerref boost/tti/has_template.hpp `has_template.hpp`]]
  70. ]
  71. [
  72. [Member data]
  73. [[headerref boost/tti/has_member_data.hpp `has_member_data.hpp`]]
  74. ]
  75. [
  76. [Member function]
  77. [[headerref boost/tti/has_member_function.hpp `has_member_function.hpp`]]
  78. ]
  79. [
  80. [Static member data]
  81. [[headerref boost/tti/has_static_member_data.hpp `has_static_member_data.hpp`]]
  82. ]
  83. [
  84. [Static member function]
  85. [[headerref boost/tti/has_static_member_function.hpp `has_static_member_function.hpp`]]
  86. ]
  87. [
  88. [Data]
  89. [[headerref boost/tti/has_data.hpp `has_data.hpp`]]
  90. ]
  91. [
  92. [Function]
  93. [[headerref boost/tti/has_function.hpp `has_function.hpp`]]
  94. ]
  95. [
  96. [Member Type Creation]
  97. [[headerref boost/tti/member_type.hpp `member_type.hpp`]]
  98. ]
  99. ]
  100. [endsect]
  101. [endsect]