|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r81509 - trunk/libs/tti/doc
From: eldiener_at_[hidden]
Date: 2012-11-24 12:35:17
Author: eldiener
Date: 2012-11-24 12:35:16 EST (Sat, 24 Nov 2012)
New Revision: 81509
URL: http://svn.boost.org/trac/boost/changeset/81509
Log:
Updated docs.
Text files modified:
trunk/libs/tti/doc/tti.qbk | 4
trunk/libs/tti/doc/tti_detail_has_member_data.qbk | 12 ++++-
trunk/libs/tti/doc/tti_detail_has_member_function.qbk | 14 ++++-
trunk/libs/tti/doc/tti_detail_has_static_member_data.qbk | 14 ++++-
trunk/libs/tti/doc/tti_detail_has_static_member_function.qbk | 14 ++++-
trunk/libs/tti/doc/tti_detail_has_template.qbk | 83 ++++++++++++++++++++++++++-------------
trunk/libs/tti/doc/tti_detail_has_type.qbk | 26 +++++++----
trunk/libs/tti/doc/tti_introduction.qbk | 12 ++++-
trunk/libs/tti/doc/tti_using_mm.qbk | 33 +++++++++------
9 files changed, 140 insertions(+), 72 deletions(-)
Modified: trunk/libs/tti/doc/tti.qbk
==============================================================================
--- trunk/libs/tti/doc/tti.qbk (original)
+++ trunk/libs/tti/doc/tti.qbk 2012-11-24 12:35:16 EST (Sat, 24 Nov 2012)
@@ -1,5 +1,5 @@
[/
- (C) Copyright Edward Diener 2011
+ (C) Copyright Edward Diener 2011,2012
Use, modification and distribution are subject to the Boost Software License,
Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt).
@@ -10,7 +10,7 @@
[version 1.6]
[id tti]
[dirname tti]
- [copyright 2010-2011 Tropic Software East Inc]
+ [copyright 2011-2012 Tropic Software East Inc]
[purpose Compile time introspection of a type]
[category generic]
[authors [Diener, Edward]]
Modified: trunk/libs/tti/doc/tti_detail_has_member_data.qbk
==============================================================================
--- trunk/libs/tti/doc/tti_detail_has_member_data.qbk (original)
+++ trunk/libs/tti/doc/tti_detail_has_member_data.qbk 2012-11-24 12:35:16 EST (Sat, 24 Nov 2012)
@@ -101,9 +101,15 @@
has_member_data_data3<int Top2::*>::value; // false
has_member_data_data3<Top Top2::*>::value; // true;
-It should be noticed that once we create our metafunction for
+[heading Metafunction re-use]
+
+The macro encodes only the name of the member data for which
+we are searching and the fact that we are introspecting for
+member data within an enclosing type.
+
+Because of this, once we create our metafunction for
introspecting an inner member data by name, we can reuse the
-metafunction for introspecting any enclosing user-defined type,
-with any inner member data type, for that name.
+metafunction for introspecting any enclosing type, having any
+inner member data type, for that name.
[endsect]
Modified: trunk/libs/tti/doc/tti_detail_has_member_function.qbk
==============================================================================
--- trunk/libs/tti/doc/tti_detail_has_member_function.qbk (original)
+++ trunk/libs/tti/doc/tti_detail_has_member_function.qbk 2012-11-24 12:35:16 EST (Sat, 24 Nov 2012)
@@ -116,9 +116,15 @@
has_member_function_function3<int Top2::* ()>::value; // false
has_member_function_function3<Top2,Top *,boost::mpl::vector<long,int,AClass &> >::value; // true;
-It should be noticed that once we create our metafunction for
-introspecting an inner member function by name, we can reuse the
-metafunction for introspecting any enclosing user-defined type,
-with any inner member function, for that name.
+[heading Metafunction re-use]
+
+The macro encodes only the name of the member function for which
+we are searching and the fact that we are introspecting for a
+member function within an enclosing type.
+
+Because of this, once we create our metafunction for
+introspecting a member function by name, we can reuse the
+metafunction for introspecting any enclosing type, having any
+member function, for that name.
[endsect]
Modified: trunk/libs/tti/doc/tti_detail_has_static_member_data.qbk
==============================================================================
--- trunk/libs/tti/doc/tti_detail_has_static_member_data.qbk (original)
+++ trunk/libs/tti/doc/tti_detail_has_static_member_data.qbk 2012-11-24 12:35:16 EST (Sat, 24 Nov 2012)
@@ -82,9 +82,15 @@
has_static_member_data_data3<Top2,int>::value; // false
has_static_member_data_data3<Top2,Top>::value; // true;
-It should be noticed that once we create our metafunction for
-introspecting an inner static member data by name, we can reuse the
-metafunction for introspecting any enclosing user-defined type,
-with any inner static member data type, for that name.
+[heading Metafunction re-use]
+
+The macro encodes only the name of the static member data for
+which we are searching and the fact that we are introspecting
+for static member data within an enclosing type.
+
+Because of this, once we create our metafunction for
+introspecting an inner static member data by name, we can reuse
+the metafunction for introspecting any enclosing type, having
+any inner static member data type, for that name.
[endsect]
Modified: trunk/libs/tti/doc/tti_detail_has_static_member_function.qbk
==============================================================================
--- trunk/libs/tti/doc/tti_detail_has_static_member_function.qbk (original)
+++ trunk/libs/tti/doc/tti_detail_has_static_member_function.qbk 2012-11-24 12:35:16 EST (Sat, 24 Nov 2012)
@@ -116,9 +116,15 @@
has_static_member_function_function3<Top2,int ()>::value; // false
has_static_member_function_function3<Top2,Top * (long,int,AClass &)>::value; // true;
-It should be noticed that once we create our metafunction for
-introspecting an inner static member function by name, we can reuse the
-metafunction for introspecting any enclosing user-defined type,
-with any inner static member function, for that name.
+[heading Metafunction re-use]
+
+The macro encodes only the name of the static member function
+for which we are searching and the fact that we are
+introspecting for a static member function within an enclosing type.
+
+Because of this, once we create our metafunction for
+introspecting a static member function by name, we can reuse the
+metafunction for introspecting any enclosing type, having any
+static member function, for that name.
[endsect]
Modified: trunk/libs/tti/doc/tti_detail_has_template.qbk
==============================================================================
--- trunk/libs/tti/doc/tti_detail_has_template.qbk (original)
+++ trunk/libs/tti/doc/tti_detail_has_template.qbk 2012-11-24 12:35:16 EST (Sat, 24 Nov 2012)
@@ -15,7 +15,7 @@
[heading Two forms of introspection]
-There are two general forms of introspection which can be used.
+There are two general forms of template introspection which can be used.
The first is to find a class template with any number of only
template type parameters ( template parameters starting with `class`
or `typename` ). In this form only the name of the class template
@@ -27,12 +27,21 @@
The second is to find a class template with specific template parameters.
In this form both the name of the class template and the template parameters
-are passed to the macro. We will call this form of the macro the
-`specific parameters` form. An example of a class template of this form which
-could be successfully introspected would be:
+are passed to the macro.
+
+We will call this form of the macro the `specific parameters` form. An example
+of a class template of this form which could be successfully introspected would be:
template<class X, template<class> class Y, int Z> BClassTemplate { /* etc. */ };
+When using the specific form of the macro, there are two things which
+need to be understood when passing the template parameters to the macro.
+First, the actual names of the template parameters passed are irrelevant.
+They can be left out completely or be different from the names in the
+nested class template itself. Second, the use of 'typename' or 'class',
+when referring to a template type parameter, is completely interchangeable,
+as it is in the actual class template itself.
+
[heading Variadic and non-variadic macro usage]
When using the BOOST_TTI_HAS_TEMPLATE macro we distinguish between compilers
@@ -80,8 +89,8 @@
The non-variadic macro form for introspecting the class templates above
using the `specific parameters` form would be:
- BOOST_TTI_TEMPLATE(AClassTemplate,(4,(class X,typename Y,class Z,typename T)))
- BOOST_TTI_TEMPLATE(BClassTemplate,(3,(class X, template<class> class Y, int Z)))
+ BOOST_TTI_TEMPLATE(AClassTemplate,(4,(class,typename,class,typename)))
+ BOOST_TTI_TEMPLATE(BClassTemplate,(3,(class, template<class> class, int)))
You need to be careful using the non-variadic `specific parameters` form
to specify the correct number of array parameters. This can sometimes be
@@ -94,8 +103,8 @@
template<void (*FunctionPointer)(int,long)> class CClassTemplate { /* etc. */ };
template<template<class,class> class T> class DClassTemplate { /* etc. */ };
- BOOST_TTI_TEMPLATE(CClassTemplate,(1,(void (*FunctionPointer)(int,long))))
- BOOST_TTI_TEMPLATE(DClassTemplate,(2,(template<class,class> class T)))
+ BOOST_TTI_TEMPLATE(CClassTemplate,(1,(void (*)(int,long))))
+ BOOST_TTI_TEMPLATE(DClassTemplate,(2,(template<class,class> class)))
In the case of using the macro to introspect CClassTemplate the number of
Boost PP array parameters is 1, even though there is a comma separating
@@ -126,14 +135,15 @@
Introspecting the other class templates above using the
`specific parameters` form the variadic macros would be:
- BOOST_TTI_TEMPLATE(BClassTemplate,class X,template<class> class Y, int Z)
- BOOST_TTI_TEMPLATE(CClassTemplate,void (*FunctionPointer)(int,long))
- BOOST_TTI_TEMPLATE(DClassTemplate,template<class,class> class T)
+ BOOST_TTI_TEMPLATE(BClassTemplate,class,template<class> class, int)
+ BOOST_TTI_TEMPLATE(CClassTemplate,void (*)(int,long))
+ BOOST_TTI_TEMPLATE(DClassTemplate,template<class,class> class)
Here we have no problem with counting the number of tuple tokens
for the Boost PP array, nor do we have to specify BOOST_PP_NIL if
-we are using the `template type parameters` form. We simply type
-the template parameters as the remaining tokens of the variadic macro.
+we are using the `template type parameters` form. Also for the
+specific parameters form we simply use the template parameters as
+the remaining tokens of the variadic macro.
[heading The resulting metafunction]
@@ -166,8 +176,8 @@
// `specific parameters` form
- BOOST_TTI_HAS_TEMPLATE(AClassTemplate,(2,(class X,int Y))) // non-variadic macro
- BOOST_TTI_HAS_TEMPLATE(AClassTemplate,class X,int Y) // variadic macro
+ BOOST_TTI_HAS_TEMPLATE(AClassTemplate,(2,(class,int))) // non-variadic macro
+ BOOST_TTI_HAS_TEMPLATE(AClassTemplate,class,int) // variadic macro
generates a metafunction called 'has_template_AClassTemplate' in the current scope.
@@ -209,17 +219,17 @@
// Using variadic macro, `specific parameters`
- BOOST_TTI_HAS_TEMPLATE(Template6,class X,int Y)
- BOOST_TTI_HAS_TEMPLATE(Template7,typename A,template<class,class> struct B,long C)
- BOOST_TTI_HAS_TEMPLATE(Template8,double X,typename Y)
- BOOST_TTI_HAS_TEMPLATE(Template9,typename A,class B,typename C,class D,typename E,short F)
+ BOOST_TTI_HAS_TEMPLATE(Template6,class,int)
+ BOOST_TTI_HAS_TEMPLATE(Template7,typename,template<class,class> struct,long)
+ BOOST_TTI_HAS_TEMPLATE(Template8,double,typename)
+ BOOST_TTI_HAS_TEMPLATE(Template9,typename,class,typename,class,typename,short)
// or using non-variadic macro, `specific parameters`
- BOOST_TTI_HAS_TEMPLATE(Template6,(2,(class X,int Y)))
- BOOST_TTI_HAS_TEMPLATE(Template7,(4,(typename A,template<class,class> struct B,long C)))
- BOOST_TTI_HAS_TEMPLATE(Template8,(2,(double X,typename Y)))
- BOOST_TTI_HAS_TEMPLATE(Template9,(6,(typename A,class B,typename C,class D,typename E,short F)))
+ BOOST_TTI_HAS_TEMPLATE(Template6,(2,(class,int)))
+ BOOST_TTI_HAS_TEMPLATE(Template7,(4,(typename,template<class,class> struct,long)))
+ BOOST_TTI_HAS_TEMPLATE(Template8,(2,(double,typename)))
+ BOOST_TTI_HAS_TEMPLATE(Template9,(6,(typename,class,typename,class,typename,short)))
Next let us create some user-defined types we want to introspect.
@@ -277,12 +287,27 @@
has_template_Template9<Top3>::value; // false
has_template_Template9<Top4>::value; // true
-It should be noticed that once we create our metafunction for
-introspecting an inner class template by name, we can reuse the
-metafunction for introspecting any enclosing user-defined type
-for that name. However we will be successful or not as long as
-we are introspecting the inner class template for either
-template type parameters or specific parameters each time.
+[heading Metafunction re-use]
+
+The macro encodes the name of the inner class template for
+which we are searching, the fact that we are introspecting for
+a class template within an enclosing type, and optionally the
+template parameters for that class template.
+
+Once we create our metafunction for introspecting an inner class
+template by name, we can reuse the metafunction for introspecting
+any enclosing type, having any inner class template, for that name.
+
+However we need to understand that we are restricted in our reuse
+of the metafunction by whether we originally use the template type
+parameters form or the specific form. In either case we are always
+introspecting an inner class template which matches that form.
+In the case of the template type parameters form, any inner class
+template for which we are introspecting must have all template type
+parameters, as well as the correct name. In the case of the specific
+parameters form, any inner class template for which we are
+introspecting must have template parameters which match the specific
+template parameters passed to the macro, as well as the correct name.
[endsect]
Modified: trunk/libs/tti/doc/tti_detail_has_type.qbk
==============================================================================
--- trunk/libs/tti/doc/tti_detail_has_type.qbk (original)
+++ trunk/libs/tti/doc/tti_detail_has_type.qbk 2012-11-24 12:35:16 EST (Sat, 24 Nov 2012)
@@ -10,13 +10,12 @@
The TTI macro [macroref BOOST_TTI_HAS_TYPE] introspects
a nested type of a class.
-BOOST_TTI_HAS_TYPE takes a single
-parameter which is the name of an inner type whose existence
-the programmer wants to check. The macro generates a metafunction
-called 'has_type_'name_of_inner_type'. The purpose of the macro
-is to check for the existence by name of an inner type and,
-optionally, check whether that inner type is equivalent to
-a particular type. This latter functionality is normally only
+BOOST_TTI_HAS_TYPE takes a single parameter which is the name of
+an inner type whose existence the programmer wants to check. The
+macro generates a metafunction called 'has_type_'name_of_inner_type'.
+The purpose of the macro is to check for the existence by name of an
+inner type and, optionally, check whether that inner type is equivalent
+to a particular type. This latter functionality is normally only
used to check whether or not the inner type is a typedef for
another type, since an inner user-defined type declares its
own type by its name.
@@ -95,8 +94,15 @@
has_type_MyType<Top>::value; // false
has_type_MyType<Top2>::value; // true
-It should be noticed that once we create our metafunction for
-introspecting an inner type by name, we can reuse the metafunction
-for introspecting any enclosing user-defined type for that name.
+[heading Metafunction re-use]
+
+The macro encodes only the name of the inner type for which
+we are searching and the fact that we are introspecting for
+an inner type within an enclosing type.
+
+Because of this, once we create our metafunction for
+introspecting an inner type by name, we can reuse the
+metafunction for introspecting any enclosing type, having
+any inner type, for that name.
[endsect]
Modified: trunk/libs/tti/doc/tti_introduction.qbk
==============================================================================
--- trunk/libs/tti/doc/tti_introduction.qbk (original)
+++ trunk/libs/tti/doc/tti_introduction.qbk 2012-11-24 12:35:16 EST (Sat, 24 Nov 2012)
@@ -12,9 +12,15 @@
TTI is a library which provides the ability to introspect by name the elements
of a type at compile time.
-TTI works through macros generating metafunctions. The metafunctions are
-then used to introspect elements of a type at compile time, always passing
-at minimum to each metafunction the type being introspected.
+TTI works through macros generating metafunctions. Metafunctions are class
+templates of a particular syntax, having a nested 'type' member. So wherever
+in C++ class templates can occur, TTI macros can be used. The metafunctions
+generated by TTI are no different from any other metafunction as defined by
+the Boost MPL library.
+
+The metafunctions generated by TTI are used to introspect elements of a type
+at compile time, always passing at minimum to each metafunction the type being
+introspected.
The name of the library has been chosen because the library offers
compile time functionality on a type, similar to the Boost Type Traits library,
Modified: trunk/libs/tti/doc/tti_using_mm.qbk
==============================================================================
--- trunk/libs/tti/doc/tti_using_mm.qbk (original)
+++ trunk/libs/tti/doc/tti_using_mm.qbk 2012-11-24 12:35:16 EST (Sat, 24 Nov 2012)
@@ -33,6 +33,7 @@
// Template
template <class> struct AMemberTemplate { };
+ template <class,class,class> struct AnotherMemberTemplate { };
template <class,class,int,class,template <class> class InnerTemplate,class,long> struct ManyParameters { };
template <class,class,int,short,class,template <class,int> class InnerTemplate,class> struct MoreParameters { };
@@ -109,39 +110,45 @@
Does T have a nested class template called 'AMemberTemplate' whose template
parameters are all types ('class' or 'typename') ?
- BOOST_TTI_HAS_TEMPLATE(AMemberTemplate)
+ BOOST_TTI_HAS_TEMPLATE(AMemberTemplate,BOOST_PP_NIL)
has_template_AMemberTemplate
<
T
>
+[heading Template using variadic macros]
+
+Does T have a nested class template called 'AMemberTemplate' whose template
+parameters are all types ('class' or 'typename') ?
+
+ BOOST_TTI_HAS_TEMPLATE(AnotherMemberTemplate)
+
+ has_template_AnotherMemberTemplate
+ <
+ T
+ >
+
[heading Template with params]
Does T have a nested class template called 'MoreParameters' whose template
parameters are specified exactly ?
- BOOST_TTI_HAS_TEMPLATE(MoreParameters,(class)(class)(int)(short)(class)(template <class)(int> class InnerTemplate)(class))
+ BOOST_TTI_HAS_TEMPLATE(MoreParameters,(8,(class,class,int,short,class,template <class,int> class,class)))
- boost::tti::has_template_check_params_MoreParameters
+ has_template_MoreParameters
<
T
>
[heading Template with params using variadic macros]
-[
-note Include the `boost/tti/tti_vm.hpp` general header file, or the
-`vm_template_params.hpp` specific header file,
-when using this macro.
-]
-
Does T have a nested class template called 'ManyParameters' whose template
parameters are specified exactly ?
- BOOST_TTI_HAS_TEMPLATE(ManyParameters,class,class,int,class,template <class> class InnerTemplate,class,long)
+ BOOST_TTI_HAS_TEMPLATE(ManyParameters,class,class,int,class,template <class> class,class,long)
- boost::tti::has_template_check_params_ManyParameters
+ has_template_ManyParameters
<
T
>
@@ -152,7 +159,7 @@
BOOST_TTI_HAS_MEMBER_DATA(IntBT)
- boost::tti::has_member_data_IntBT
+ has_member_data_IntBT
<
T,
AType::BType
@@ -165,7 +172,7 @@
BOOST_TTI_HAS_MEMBER_FUNCTION(IntFunction)
- boost::tti::has_member_function_IntFunction
+ has_member_function_IntFunction
<
T,
int,
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