Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r68025 - sandbox/tti/libs/tti/doc
From: eldiener_at_[hidden]
Date: 2011-01-11 21:49:36


Author: eldiener
Date: 2011-01-11 21:49:33 EST (Tue, 11 Jan 2011)
New Revision: 68025
URL: http://svn.boost.org/trac/boost/changeset/68025

Log:
Updated docs
Text files modified:
   sandbox/tti/libs/tti/doc/TTIDetail.qbk | 7 ++-
   sandbox/tti/libs/tti/doc/TTIFunctionality.qbk | 12 +++---
   sandbox/tti/libs/tti/doc/TTIMetafunctions.qbk | 72 +++++++++++++++++++++++++++++++++++++--
   sandbox/tti/libs/tti/doc/TTINestedType.qbk | 12 ++----
   sandbox/tti/libs/tti/doc/TTIToDo.qbk | 2
   5 files changed, 83 insertions(+), 22 deletions(-)

Modified: sandbox/tti/libs/tti/doc/TTIDetail.qbk
==============================================================================
--- sandbox/tti/libs/tti/doc/TTIDetail.qbk (original)
+++ sandbox/tti/libs/tti/doc/TTIDetail.qbk 2011-01-11 21:49:33 EST (Tue, 11 Jan 2011)
@@ -55,7 +55,8 @@
     ]
     [
     tti::has\_template\_'name'[br]
- class T = enclosing type
+ class T = enclosing type[br]
+ All of the template parameters must be 'class' ( or 'typename' ) parameters
     ]
   ]
   [
@@ -88,7 +89,9 @@
     ]
     [
     tti::has\_member\_'name'[br]
- class T = pointer to data or function member
+ class T = pointer to data or function member[br]
+ The form for T is 'Type Class::*' for member data[br]
+ The form for T is 'ReturnType (Class::*)(Zero or more comma-separated parameter types)' for member function
     ]
   ]
   [

Modified: sandbox/tti/libs/tti/doc/TTIFunctionality.qbk
==============================================================================
--- sandbox/tti/libs/tti/doc/TTIFunctionality.qbk (original)
+++ sandbox/tti/libs/tti/doc/TTIFunctionality.qbk 2011-01-11 21:49:33 EST (Tue, 11 Jan 2011)
@@ -25,14 +25,14 @@
 namespace called 'tti', and come in two forms:
 
 # In the simplest form the 'name' of the inner element is used directly to generate the name
- of the metafunction as well as serving as the 'name' to introspect. The 'name' is appended
- to the name of the macro, with the TTI_ prefix removed, a final underscore added, and the
- macro part of the name in lower case. As an example, for the macro TTI_HAS_TYPE(MyType) the
- name of the metafunction is 'tti::has_type_MyType' and it will look for an inner type
- called 'MyType'.
+ of the metafunction as well as serving as the 'name' to introspect. To generate the name of
+ the metafunction the 'name' is appended to the name of the macro, with the TTI_ prefix removed,
+ a final underscore added, and the macro part of the name in lower case. As an example, for the
+ macro TTI_HAS_TYPE(MyType) the name of the metafunction is 'tti::has_type_MyType' and it will
+ look for an inner type called 'MyType'.
 # In the slightly more complicated form, which I call the complex form, the macro starts with
   TTI\_TRAIT\_ and a 'trait' name is passed as the first parameter, with the 'name' of the inner
- element as the second parameter. The 'trait' serves only to completely name the metafunction in
+ element as the second parameter. The 'trait' name serves only to completely name the metafunction in
   the tti namespace. As an example, for the macro TTI_TRAIT_HAS_TYPE(MyTrait,MyType) the name of
   the metafunction is 'tti::MyTrait' and it will look for an inner type called 'MyType'.
   

Modified: sandbox/tti/libs/tti/doc/TTIMetafunctions.qbk
==============================================================================
--- sandbox/tti/libs/tti/doc/TTIMetafunctions.qbk (original)
+++ sandbox/tti/libs/tti/doc/TTIMetafunctions.qbk 2011-01-11 21:49:33 EST (Tue, 11 Jan 2011)
@@ -9,7 +9,7 @@
 possibly other types which make up the signature of whatever inner element we are introspecting. Each of these
 'types' is passed as a nullary metafunction whose typedef 'type' is the actual type.
 
-It is important to understand what this accomplishes. For a type which is in scope, we can always use
+For a type which is in scope, we can always use
 boost::mpl::identity to create our nullary metafunction, and there can never be a compiler error for
 such known types as long as such declarations for them exist. For nested types, which may or may not
 exist, we can pass the result of the macro pair TTI\_MEMBER\_TYPE ( TTI\_TRAIT\_MEMBER\_TYPE ) or its equivalent
@@ -129,6 +129,16 @@
   ]
 ]
 
+Other than the use of all types as nullary metafunctions, one other difference
+in the nested type metafunctions from their macro metafunction counterparts is
+that the signature for member functions, member data, and static member functions
+is broken down into individual types, rather than the combined type notation which
+the macro metafunctions use. This allows us to specify nested types
+in those signatures without using the T::InnerType notation. One can even take our
+nested types and create new types from them.
+
+[heading Nested type metafunction member_type equivalent]
+
 Just as there is the macro pair TTI\_MEMBER\_TYPE (TTI\_TRAIT\_MEMBER\_TYPE) for creating
 a macro metafunction which returns a nested type if it exists, else an unspecified
 type, there is also the equivalent metafunction.
@@ -153,11 +163,63 @@
 ]
 
 The use of this metafunction allows us to created deeply nested types,
-which may or may not exist, as nullary metafunctions. This then can
-be used with the other nested type metafunctions above. The key
-information above is that the enclosing type is a nullary metafunction,
+which may or may not exist, as nullary metafunctions in much the same way
+that TTI\_MEMBER\_TYPE (TTI\_TRAIT\_MEMBER\_TYPE) can. The difference is
+the simpler syntax when using mf\_member\_type.
+
+As an example, given the theoretical relationship of types we used before:
+
+struct T
+ {
+ struct AType
+ {
+ struct BType
+ {
+ struct CType
+ {
+ struct FindType
+ {
+ };
+ }
+ };
+ };
+ };
+
+We can use mf_member_type as follows. First we create our corresponding macro metafunctions:
+
+TTI\_MEMBER\_TYPE(FindType)
+TTI\_MEMBER\_TYPE(AType)
+TTI\_MEMBER\_TYPE(BType)
+TTI\_MEMBER\_TYPE(CType)
+
+Next we can create a typedef to reflect a nested type called FindType which has the relationship
+as specified above by instantiating using mf_member_type.
+
+typedef
+tti::mf\_member\_type
+ <
+ tti::member\_type\_FindType,
+ tti::mf\_member\_type
+ <
+ tti::member\_type\_CType,
+ tti::mf\_member\_type
+ <
+ tti::member\_type\_BType,
+ tti::member\_type\_AType
+ <
+ T
+ >
+ >
+ >
+ > MyFindType;
+
+The nested type created can be used with the other nested type metafunctions above.
+The key information above is that the enclosing type is a nullary metafunction,
 which means that the enclosing type can be specified as the result
 of using TTI\_MEMBER\_TYPE (TTI\_TRAIT\_MEMBER\_TYPE) as well as the
-result of using mf\_member\_type itself.
+result of using mf\_member\_type itself. Both techniques are shown in the example
+above, and the same technique for creating nested types as nullary metafunctions
+can be used with the other functionality of the nested type metafunctions when
+nested types are used.
 
 [endsect]

Modified: sandbox/tti/libs/tti/doc/TTINestedType.qbk
==============================================================================
--- sandbox/tti/libs/tti/doc/TTINestedType.qbk (original)
+++ sandbox/tti/libs/tti/doc/TTINestedType.qbk 2011-01-11 21:49:33 EST (Tue, 11 Jan 2011)
@@ -78,7 +78,6 @@
     };
   };
 
-
 We can represent this by first creating a series of member type macros for each of our nested
 types:
 
@@ -93,14 +92,11 @@
 typedef typename
 tti::member\_type\_FindType
   <
- typename
- tti::member\_type\_CType
+ typename tti::member\_type\_CType
     <
- typename
- tti::member\_type\_BType
+ typename tti::member\_type\_BType
       <
- typename
- tti::member\_type\_AType
+ typename tti::member\_type\_AType
         <
         T
>::type
@@ -151,7 +147,7 @@
>
   
 Because this duplicates much of our code to create our nested type as a metafunction,
-TTI\_MEMBER\_TYPE also has, as a conveniende, a boolean compile-time constant value
+TTI\_MEMBER\_TYPE also has, as a convenience, a boolean compile-time constant value
 called 'valid' which returns 'true' if our nested type exists or 'false' if it does not.
 
 [heading A more elegant solution]

Modified: sandbox/tti/libs/tti/doc/TTIToDo.qbk
==============================================================================
--- sandbox/tti/libs/tti/doc/TTIToDo.qbk (original)
+++ sandbox/tti/libs/tti/doc/TTIToDo.qbk 2011-01-11 21:49:33 EST (Tue, 11 Jan 2011)
@@ -1,7 +1,7 @@
 [section:tti_todo ToDo]
 
 * Use FunctionTypes tag type for the function nested metafunctions.
-* Create mtafunctions that work with mpl lambda expressions.
+* Create metafunctions that work with mpl lambda expressions.
 * See if function templates can be introspected.
 * Put some examples in the documentation.
 * Find a workarounnd so that gcc3+ can compile TTI correctly.


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk