Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r68742 - in sandbox/tti/boost/tti: . detail
From: eldiener_at_[hidden]
Date: 2011-02-08 20:49:50


Author: eldiener
Date: 2011-02-08 20:49:48 EST (Tue, 08 Feb 2011)
New Revision: 68742
URL: http://svn.boost.org/trac/boost/changeset/68742

Log:
Further cleanup and support for metafunction classes
Added:
   sandbox/tti/boost/tti/detail/TTIntrospectionVMDetail.hpp (contents, props changed)
Text files modified:
   sandbox/tti/boost/tti/TTIntrospection.hpp | 436 +++++++++++++++++++++++++--------------
   sandbox/tti/boost/tti/TTIntrospectionTemplate.hpp | 10
   sandbox/tti/boost/tti/TTIntrospectionVM.hpp | 119 +++-------
   sandbox/tti/boost/tti/detail/TTIntrospectionDetail.hpp | 149 +++++++++++++
   4 files changed, 471 insertions(+), 243 deletions(-)

Modified: sandbox/tti/boost/tti/TTIntrospection.hpp
==============================================================================
--- sandbox/tti/boost/tti/TTIntrospection.hpp (original)
+++ sandbox/tti/boost/tti/TTIntrospection.hpp 2011-02-08 20:49:48 EST (Tue, 08 Feb 2011)
@@ -5,17 +5,13 @@
 #include <boost/function_types/property_tags.hpp>
 #include <boost/mpl/has_xxx.hpp>
 #include <boost/mpl/apply.hpp>
-#include <boost/mpl/bool.hpp>
 #include <boost/mpl/eval_if.hpp>
 #include <boost/mpl/identity.hpp>
+#include <boost/mpl/not.hpp>
 #include <boost/mpl/placeholders.hpp>
 #include <boost/mpl/transform.hpp>
 #include <boost/mpl/vector.hpp>
-#include <boost/preprocessor/arithmetic/add.hpp>
 #include <boost/preprocessor/cat.hpp>
-#include <boost/preprocessor/seq/enum.hpp>
-#include <boost/preprocessor/seq/size.hpp>
-#include <boost/type_traits/detail/yes_no_type.hpp>
 #include <boost/type_traits/is_same.hpp>
 #include <boost/type_traits/remove_const.hpp>
 #include "TTIntrospectionTemplate.hpp"
@@ -73,6 +69,23 @@
   } \
 /**/
 
+/// Expands to a metafunction class which tests whether an inner type with a particular name exists and optionally is a particular type.
+/**
+
+ trait = the name of the metafunction class within the tti namespace.<br />
+ name = the name of the inner type.
+
+ returns = a metfunction class called "tti::trait" where 'trait' is the macro parameter.
+
+ The metafunction class's 'apply' metafunction types and return:
+
+ T = the enclosing type in which to look for our 'name'.<br />
+ U = the type of the inner type named 'name' as an optional parameter.<br />
+ returns = 'value' is true if the 'name' type exists within the enclosing type
+ and, if type U is specified, the 'name' type is the same as the type U,
+ otherwise 'value' is false.
+
+*/
 #define TTI_MTFC_TRAIT_HAS_TYPE(trait,name) \
 namespace tti \
   { \
@@ -126,6 +139,22 @@
   ) \
 /**/
 
+/// Expands to a metafunction class which tests whether an inner type with a particular name exists and optionally is a particular type.
+/**
+
+ name = the name of the inner type.
+
+ returns = a metafunction class called "tti::mtfc_has_type_name" where 'name' is the macro parameter.
+
+ The metafunction class's 'apply' metafunction types and return:
+
+ T = the enclosing type in which to look for our 'name'.<br />
+ U = the type of the inner type named 'name' as an optional parameter.<br />
+ returns = 'value' is true if the 'name' type exists within the enclosing type
+ and, if type U is specified, the 'name' type is the same as the type U,
+ otherwise 'value' is false.
+
+*/
 #define TTI_MTFC_HAS_TYPE(name) \
   TTI_MTFC_TRAIT_HAS_TYPE \
   ( \
@@ -177,6 +206,26 @@
   } \
 /**/
 
+/// Expands to a metafunction class whose typedef 'type' is either the named type or an unspecified type.
+/**
+
+ trait = the name of the metafunction class within the tti namespace.<br />
+ name = the name of the inner type.
+
+ returns = a metafunction class called "tti::trait" where 'trait' is the macro parameter.
+
+ The metafunction class's 'apply' metafunction types and return:
+
+ T = the enclosing type.<br />
+ returns = 'type' is the inner type of 'name' if the inner type exists
+ within the enclosing type, else 'type' is an unspecified type.<br />
+
+ The purpose of this macro is to encapsulate the 'name' type as the typedef 'type'
+ of a metafunction class, but only if it exists within the enclosing type. This allows for
+ a lazy evaluation of inner type existence which can be used by other metafunctions
+ in this library.
+
+*/
 #define TTI_MTFC_TRAIT_MEMBER_TYPE(trait,name) \
 namespace tti \
   { \
@@ -230,6 +279,25 @@
   ) \
 /**/
   
+/// Expands to a metafunction class whose typedef 'type' is either the named type or an unspecified type.
+/**
+
+ name = the name of the inner type.
+
+ returns = a metafunction class called "tti::member_type_name" where 'name' is the macro parameter.
+
+ The metafunction class's 'apply' metafunction types and return:
+
+ T = the enclosing type.<br />
+ returns = 'type' is the inner type of 'name' if the inner type exists
+ within the enclosing type, else 'type' is an unspecified type.<br />
+
+ The purpose of this macro is to encapsulate the 'name' type as the typedef 'type'
+ of a metafunction class, but only if it exists within the enclosing type. This allows for
+ a lazy evaluation of inner type existence which can be used by other metafunctions
+ in this library.
+
+*/
 #define TTI_MTFC_MEMBER_TYPE(name) \
   TTI_MTFC_TRAIT_MEMBER_TYPE \
   ( \
@@ -272,6 +340,23 @@
   } \
 /**/
   
+/// Expands to a metafunction class which tests whether an inner class template with a particular name exists.
+/**
+
+ trait = the name of the metafunction class within the tti namespace.<br />
+ name = the name of the inner template.
+
+ returns = a metafunction class called "tti::trait" where 'trait' is the macro parameter.
+
+ The metafunction class's 'apply' metafunction types and return:
+
+ T = the enclosing type in which to look for our 'name'.<br />
+ returns = 'value' is true if the 'name' template exists within the enclosing type,
+ otherwise 'value' is false.
+
+ The template must have all 'class' ( or 'typename' ) parameters types.
+
+*/
 #define TTI_MTFC_TRAIT_HAS_TEMPLATE(trait,name) \
 namespace tti \
   { \
@@ -316,6 +401,22 @@
   ) \
 /**/
 
+/// Expands to a metafunction class which tests whether an inner class template with a particular name exists.
+/**
+
+ name = the name of the inner template.
+
+ returns = a metafunction class called "tti::has_template_name" where 'name' is the macro parameter.
+
+ The metafunction class's 'apply' metafunction types and return:
+
+ T = the enclosing type in which to look for our 'name'.<br />
+ returns = 'value' is true if the 'name' template exists within the enclosing type,
+ otherwise 'value' is false.
+
+ The template must have all 'class' ( or 'typename' ) parameters types.
+
+*/
 #define TTI_MTFC_HAS_TEMPLATE(name) \
   TTI_MTFC_TRAIT_HAS_TEMPLATE \
   ( \
@@ -324,9 +425,6 @@
   ) \
 /**/
 
-#if !defined(BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE)
-#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1400)
-
 /// Expands to a metafunction which tests whether an inner class template with a particular name and signature exists.
 /**
 
@@ -349,40 +447,32 @@
 #define TTI_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,tpSeq) \
 namespace tti \
   { \
- TTI_DETAIL_HAS_MEMBER_WITH_FUNCTION_SFINAE \
- ( \
- ( BOOST_PP_ADD(BOOST_PP_SEQ_SIZE(tpSeq),4), ( trait, name, 1, false, BOOST_PP_SEQ_ENUM(tpSeq) ) ) \
- ) \
- } \
-/**/
-
-#define TTI_MTFC_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,tpSeq) \
-namespace tti \
- { \
+ namespace detail \
+ { \
+ TTI_DETAIL_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,tpSeq) \
+ } \
+ template<class T> \
   struct trait \
     { \
- TTI_DETAIL_HAS_MEMBER_WITH_FUNCTION_SFINAE \
- ( \
- ( BOOST_PP_ADD(BOOST_PP_SEQ_SIZE(tpSeq),4), ( apply, name, 1, false, BOOST_PP_SEQ_ENUM(tpSeq) ) ) \
- ) \
+ typedef typename detail::trait<T>::type type; \
+ \
+ BOOST_STATIC_CONSTANT(bool,value=type::value); \
     }; \
   } \
 /**/
 
-#else // !!BOOST_WORKAROUND(BOOST_MSVC, <= 1400)
-
-/// Expands to a metafunction which tests whether an inner class template with a particular name and signature exists.
+/// Expands to a metafunction class which tests whether an inner class template with a particular name and signature exists.
 /**
 
- trait = the name of the metafunction within the tti namespace.<br />
+ trait = the name of the metafunction class within the tti namespace.<br />
     name = the name of the inner class template.<br />
     tpSeq = a Boost PP sequence which has the class template parameters.
             Each part of the template parameters separated by a comma ( , )
             is put in a separate sequence element.<br />
 
- returns = a metafunction called "tti::trait" where 'trait' is the macro parameter.
+ returns = a metafunction class called "tti::trait" where 'trait' is the macro parameter.
     
- The metafunction types and return:
+ The metafunction class's 'apply' metafunction types and return:
     
                 T = the enclosing type in which to look for our 'name'.<br />
                 returns = 'value' is true if the 'name' class template with the signature
@@ -390,39 +480,35 @@
                           otherwise 'value' is false.
     
 */
-#define TTI_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,tpSeq) \
-namespace tti \
- { \
- TTI_DETAIL_HAS_MEMBER_WITH_TEMPLATE_SFINAE \
- ( \
- ( BOOST_PP_ADD(BOOST_PP_SEQ_SIZE(tpSeq),4), ( trait, name, 1, false, BOOST_PP_SEQ_ENUM(tpSeq) ) ) \
- ) \
- } \
-/**/
-
 #define TTI_MTFC_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,tpSeq) \
 namespace tti \
   { \
- TTI_DETAIL_MTFC_HAS_MEMBER_WITH_TEMPLATE_SFINAE \
- ( \
- ( BOOST_PP_ADD(BOOST_PP_SEQ_SIZE(tpSeq),4), ( trait, name, 1, false, BOOST_PP_SEQ_ENUM(tpSeq) ) ) \
- ) \
+ namespace detail \
+ { \
+ TTI_DETAIL_MTFC_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,tpSeq) \
+ } \
+ struct trait \
+ { \
+ template<class T> \
+ struct apply \
+ { \
+ typedef typename detail::trait::apply<T>::type type; \
+ \
+ BOOST_STATIC_CONSTANT(bool,value=type::value); \
+ }; \
+ }; \
   } \
 /**/
 
-#endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1400)
-#else // !!defined(BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE)
-
 /// Expands to a metafunction which tests whether an inner class template with a particular name and signature exists.
 /**
 
- trait = the name of the metafunction within the tti namespace.<br />
     name = the name of the inner class template.<br />
     tpSeq = a Boost PP sequence which has the class template parameters.
             Each part of the template parameters separated by a comma ( , )
- is put in a separate sequence element.<br />
+ is put in a separate sequence element.
 
- returns = a metafunction called "tti::trait" where 'trait' is the macro parameter.
+ returns = a metafunction called "tti::has_template_check_params_name" where 'name' is the macro parameter.
     
               The metafunction types and return:
     
@@ -432,26 +518,16 @@
                           otherwise 'value' is false.
     
 */
-#define TTI_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,tpSeq) \
-namespace tti \
- { \
- TTI_DETAIL_SAME(trait,name) \
- } \
-/**/
-
-#define TTI_MTFC_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,tpSeq) \
-namespace tti \
- { \
- struct trait \
- { \
- TTI_DETAIL_SAME(apply,name) \
- }; \
- } \
+#define TTI_HAS_TEMPLATE_CHECK_PARAMS(name,tpSeq) \
+ TTI_TRAIT_HAS_TEMPLATE_CHECK_PARAMS \
+ ( \
+ BOOST_PP_CAT(has_template_check_params_,name), \
+ name, \
+ tpSeq \
+ ) \
 /**/
 
-#endif // !defined(BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE)
-
-/// Expands to a metafunction which tests whether an inner class template with a particular name and signature exists.
+/// Expands to a metafunction class which tests whether an inner class template with a particular name and signature exists.
 /**
 
     name = the name of the inner class template.<br />
@@ -459,9 +535,9 @@
             Each part of the template parameters separated by a comma ( , )
             is put in a separate sequence element.
 
- returns = a metafunction called "tti::has_template_check_params_name" where 'name' is the macro parameter.
+ returns = a metafunction class called "tti::has_template_check_params_name" where 'name' is the macro parameter.
     
- The metafunction types and return:
+ The metafunction class's 'apply' metafunction types and return:
     
                 T = the enclosing type in which to look for our 'name'.<br />
                 returns = 'value' is true if the 'name' class template with the signature
@@ -469,15 +545,6 @@
                           otherwise 'value' is false.
     
 */
-#define TTI_HAS_TEMPLATE_CHECK_PARAMS(name,tpSeq) \
- TTI_TRAIT_HAS_TEMPLATE_CHECK_PARAMS \
- ( \
- BOOST_PP_CAT(has_template_check_params_,name), \
- name, \
- tpSeq \
- ) \
-/**/
-
 #define TTI_MTFC_HAS_TEMPLATE_CHECK_PARAMS(name,tpSeq) \
   TTI_MTFC_TRAIT_HAS_TEMPLATE_CHECK_PARAMS \
   ( \
@@ -579,6 +646,24 @@
   } \
 /**/
 
+/// Expands to a metafunction class which tests whether a member function with a particular name and signature exists.
+/**
+
+ trait = the name of the metafunction class within the tti namespace.<br />
+ name = the name of the inner member.
+
+ returns = a metafunction class called "tti::trait" where 'trait' is the macro parameter.<br />
+
+ The metafunction class's 'apply' metafunction types and return:
+
+ T = the enclosing type in which to look for our 'name'.<br />
+ R = the return type of the member function.<br />
+ FS = an optional parameter which are the parameters of the member function as a boost::mpl forward sequence.<br />
+ TAG = an optional parameter which is a boost::function_types tag to apply to the member function.<br />
+ returns = 'value' is true if the 'name' exists, with the appropriate type,
+ otherwise 'value' is false.
+
+*/
 #define TTI_MTFC_TRAIT_HAS_MEMBER_FUNCTION(trait,name) \
 namespace tti \
   { \
@@ -624,6 +709,23 @@
   ) \
 /**/
 
+/// Expands to a metafunction class which tests whether a member function with a particular name and signature exists.
+/**
+
+ name = the name of the inner member.
+
+ returns = a metafunction class called "tti::has_member_function_name" where 'name' is the macro parameter.
+
+ The metafunction class's 'apply' metafunction types and return:
+
+ T = the enclosing type in which to look for our 'name'.<br />
+ R = the return type of the member function.<br />
+ FS = an optional parameter which are the parameters of the member function as a boost::mpl forward sequence.<br />
+ TAG = an optional parameter which is a boost::function_types tag to apply to the member function.<br />
+ returns = 'value' is true if the 'name' exists, with the appropriate type,
+ otherwise 'value' is false.
+
+*/
 #define TTI_MTFC_HAS_MEMBER_FUNCTION(name) \
   TTI_MTFC_TRAIT_HAS_MEMBER_FUNCTION \
   ( \
@@ -665,6 +767,22 @@
   } \
 /**/
 
+/// Expands to a metafunction class which tests whether a member data with a particular name and type exists.
+/**
+
+ trait = the name of the metafunction class within the tti namespace.<br />
+ name = the name of the inner member.
+
+ returns = a metafunction class called "tti::trait" where 'trait' is the macro parameter.<br />
+
+ The metafunction class's 'apply' metafunction types and return:
+
+ T = the enclosing type in which to look for our 'name'.<br />
+ R = the type of the member data.<br />
+ returns = 'value' is true if the 'name' exists, with the appropriate type,
+ otherwise 'value' is false.
+
+*/
 #define TTI_MTFC_TRAIT_HAS_MEMBER_DATA(trait,name) \
 namespace tti \
   { \
@@ -708,6 +826,21 @@
   ) \
 /**/
 
+/// Expands to a metafunction class which tests whether a member data with a particular name and type exists.
+/**
+
+ name = the name of the inner member.
+
+ returns = a metafunction class called "tti::has_member_data_name" where 'name' is the macro parameter.
+
+ The metafunction class's 'apply' metafunction types and return:
+
+ T = the enclosing type in which to look for our 'name'.<br />
+ R = the type of the member data.<br />
+ returns = 'value' is true if the 'name' exists, with the appropriate type,
+ otherwise 'value' is false.
+
+*/
 #define TTI_MTFC_HAS_MEMBER_DATA(name) \
   TTI_MTFC_TRAIT_HAS_MEMBER_DATA \
   ( \
@@ -716,8 +849,6 @@
   ) \
 /**/
 
-#if defined(BOOST_NO_NULLPTR)
-
 /// Expands to a metafunction which tests whether a static member data or a static member function with a particular name and type exists.
 /**
 
@@ -740,61 +871,29 @@
 #define TTI_TRAIT_HAS_STATIC_MEMBER(trait,name) \
 namespace tti \
   { \
+ namespace detail \
+ { \
+ TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER(trait,name) \
+ } \
   template<class T,class Type> \
   struct trait \
     { \
- template<Type *> \
- struct helper; \
- \
- template<class U> \
- static ::boost::type_traits::yes_type check(helper<&U::name> *); \
- \
- template<class U> \
- static ::boost::type_traits::no_type check(...); \
+ typedef typename detail::trait<T,Type>::type type; \
     \
- BOOST_STATIC_CONSTANT(bool,value=sizeof(check<T>(0))==sizeof(::boost::type_traits::yes_type)); \
- \
- typedef boost::mpl::bool_<value> type; \
- }; \
- } \
-/**/
-
-#define TTI_MTFC_TRAIT_HAS_STATIC_MEMBER(trait,name) \
-namespace tti \
- { \
- struct trait \
- { \
- template<class T,class Type> \
- struct apply \
- { \
- template<Type *> \
- struct helper; \
- \
- template<class U> \
- static ::boost::type_traits::yes_type check(helper<&U::name> *); \
- \
- template<class U> \
- static ::boost::type_traits::no_type check(...); \
- \
- BOOST_STATIC_CONSTANT(bool,value=sizeof(check<T>(0))==sizeof(::boost::type_traits::yes_type)); \
- \
- typedef boost::mpl::bool_<value> type; \
- }; \
+ BOOST_STATIC_CONSTANT(bool,value=type::value); \
     }; \
   } \
 /**/
 
-#else // !defined(BOOST_NO_NULLPTR)
-
-/// Expands to a metafunction which tests whether a static member data or a static member function with a particular name and type exists.
+/// Expands to a metafunction class which tests whether a static member data or a static member function with a particular name and type exists.
 /**
 
- trait = the name of the metafunction within the tti namespace.<br />
+ trait = the name of the metafunction class within the tti namespace.<br />
     name = the name of the inner member.
 
- returns = a metafunction called "tti::trait" where 'trait' is the macro parameter.<br />
+ returns = a metafunction class called "tti::trait" where 'trait' is the macro parameter.<br />
     
- The metafunction types and return:
+ The metafunction class's 'apply' metafunction types and return:
     
                 T = the enclosing type.<br />
                 Type = the static member data or static member function type,
@@ -805,55 +904,27 @@
                           otherwise 'value' is false.
                           
 */
-#define TTI_TRAIT_HAS_STATIC_MEMBER(trait,name) \
-namespace tti \
- { \
- template<class T,class Type> \
- struct trait \
- { \
- template<Type *> \
- struct helper; \
- \
- template<class U> \
- static ::boost::type_traits::yes_type check(helper<&U::name> *); \
- \
- template<class U> \
- static ::boost::type_traits::no_type check(...); \
- \
- BOOST_STATIC_CONSTANT(bool,value=sizeof(check<T>(nullptr))==sizeof(::boost::type_traits::yes_type)); \
- \
- typedef boost::mpl::bool_<value> type; \
- }; \
- } \
-/**/
-
 #define TTI_MTFC_TRAIT_HAS_STATIC_MEMBER(trait,name) \
 namespace tti \
   { \
+ namespace detail \
+ { \
+ TTI_DETAIL_MTFC_TRAIT_HAS_STATIC_MEMBER(trait,name) \
+ } \
   struct trait \
     { \
     template<class T,class Type> \
     struct apply \
       { \
- template<Type *> \
- struct helper; \
- \
- template<class U> \
- static ::boost::type_traits::yes_type check(helper<&U::name> *); \
- \
- template<class U> \
- static ::boost::type_traits::no_type check(...); \
+ typedef typename detail::trait::apply<T,Type>::type type; \
       \
- BOOST_STATIC_CONSTANT(bool,value=sizeof(check<T>(nullptr))==sizeof(::boost::type_traits::yes_type)); \
- \
- typedef boost::mpl::bool_<value> type; \
+ BOOST_STATIC_CONSTANT(bool,value=type::value); \
       }; \
     }; \
   } \
 /**/
 
-#endif // defined(BOOST_NO_NULLPTR)
-
+
 /// Expands to a metafunction which tests whether a static member data or a static member function with a particular name and type exists.
 /**
 
@@ -880,6 +951,24 @@
   ) \
 /**/
 
+/// Expands to a metafunction class which tests whether a static member data or a static member function with a particular name and type exists.
+/**
+
+ name = the name of the inner member.
+
+ returns = a metafunction class called "tti::has_static_member_name" where 'name' is the macro parameter.<br />
+
+ The metafunction class's 'apply' metafunction types and return:
+
+ T = the enclosing type.<br />
+ Type = the static member data or static member function type,
+ in the form of a data or function type,
+ in which to look for our 'name'.<br />
+ returns = 'value' is true if the 'name' exists within the enclosing type,
+ with the appropriate type,
+ otherwise 'value' is false.
+
+*/
 #define TTI_MTFC_HAS_STATIC_MEMBER(name) \
   TTI_MTFC_TRAIT_HAS_STATIC_MEMBER \
   ( \
@@ -923,6 +1012,24 @@
   } \
 /**/
 
+/// Expands to a metafunction class which tests whether a static member function with a particular name and signature exists.
+/**
+
+ trait = the name of the metafunction class within the tti namespace.<br />
+ name = the name of the inner member.
+
+ returns = a metafunction class called "tti::trait" where 'trait' is the macro parameter.<br />
+
+ The metafunction class's 'apply' metafunction types and return:
+
+ T = the enclosing type in which to look for our 'name'.<br />
+ R = the return type of the static member function.<br />
+ FS = an optional parameter which are the parameters of the static member function as a boost::mpl forward sequence.<br />
+ TAG = an optional parameter which is a boost::function_types tag to apply to the static member function.<br />
+ returns = 'value' is true if the 'name' exists, with the appropriate type,
+ otherwise 'value' is false.
+
+*/
 #define TTI_MTFC_TRAIT_HAS_STATIC_MEMBER_FUNCTION(trait,name) \
 namespace tti \
   { \
@@ -968,6 +1075,23 @@
   ) \
 /**/
 
+/// Expands to a metafunction class which tests whether a static member function with a particular name and signature exists.
+/**
+
+ name = the name of the inner member.
+
+ returns = a metafunction class called "tti::has_static_member_function_name" where 'name' is the macro parameter.
+
+ The metafunction class's 'apply' metafunction types and return:
+
+ T = the enclosing type in which to look for our 'name'.<br />
+ R = the return type of the static member function.<br />
+ FS = an optional parameter which are the parameters of the static member function as a boost::mpl forward sequence.<br />
+ TAG = an optional parameter which is a boost::function_types tag to apply to the static member function.<br />
+ returns = 'value' is true if the 'name' exists, with the appropriate type,
+ otherwise 'value' is false.
+
+*/
 #define TTI_MTFC_HAS_STATIC_MEMBER_FUNCTION(name) \
   TTI_MTFC_TRAIT_HAS_STATIC_MEMBER_FUNCTION \
   ( \

Modified: sandbox/tti/boost/tti/TTIntrospectionTemplate.hpp
==============================================================================
--- sandbox/tti/boost/tti/TTIntrospectionTemplate.hpp (original)
+++ sandbox/tti/boost/tti/TTIntrospectionTemplate.hpp 2011-02-08 20:49:48 EST (Tue, 08 Feb 2011)
@@ -1,6 +1,7 @@
 #if !defined(TT_INTROSPECTION_TEMPLATE_HPP)
 #define TT_INTROSPECTION_TEMPLATE_HPP
 
+#include <boost/config.hpp>
 #include <boost/mpl/identity.hpp>
 #include <boost/mpl/apply.hpp>
 #include "detail/TTIntrospectionDetail.hpp"
@@ -38,10 +39,13 @@
     class HasTemplateCheckParams,
     class T
>
- struct mf_has_template_check_params
+ struct mf_has_template_check_params :
+ boost::mpl::apply
+ <
+ HasTemplateCheckParams,
+ typename T::type
+ >::type
     {
- typedef typename boost::mpl::apply<HasTemplateCheckParams,typename T::type>::type type;
- BOOST_STATIC_CONSTANT(bool,value=type::value);
     };
   }
   

Modified: sandbox/tti/boost/tti/TTIntrospectionVM.hpp
==============================================================================
--- sandbox/tti/boost/tti/TTIntrospectionVM.hpp (original)
+++ sandbox/tti/boost/tti/TTIntrospectionVM.hpp 2011-02-08 20:49:48 EST (Tue, 08 Feb 2011)
@@ -2,13 +2,12 @@
 #define TT_INTROSPECTION_VM_HPP
 
 #include <boost/config.hpp>
-#include <boost/mpl/has_xxx.hpp>
-#include <boost/mpl/identity.hpp>
-#include <boost/preprocessor/arithmetic/add.hpp>
-#include <boost/preprocessor/cat.hpp>
-#include <boost/variadic_macro_data/VariadicMacroData.hpp>
 #include "TTIntrospectionTemplate.hpp"
-#include "detail/TTIntrospectionDetail.hpp"
+
+#if !defined(BOOST_NO_VARIADIC_MACROS)
+
+#include <boost/preprocessor/cat.hpp>
+#include "detail/TTIntrospectionVMDetail.hpp"
 
 /*
 
@@ -19,10 +18,6 @@
 /** \file
 */
 
-#if !defined(BOOST_NO_VARIADIC_MACROS)
-#if !defined(BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE)
-#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1400)
-
 /// Expands to a metafunction which tests whether an inner class template with a particular name and signature exists.
 /**
 
@@ -43,38 +38,30 @@
 #define TTI_VM_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,...) \
 namespace tti \
   { \
- TTI_DETAIL_HAS_MEMBER_WITH_FUNCTION_SFINAE \
- ( \
- ( BOOST_PP_ADD(VMD_DATA_SIZE(__VA_ARGS__),4), ( trait, name, 1, false, __VA_ARGS__ ) ) \
- ) \
- } \
-/**/
-
-#define TTI_VM_MTFC_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,...) \
-namespace tti \
- { \
+ namespace detail \
+ { \
+ TTI_VM_DETAIL_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,__VA_ARGS__) \
+ } \
+ template<class T> \
   struct trait \
     { \
- TTI_DETAIL_HAS_MEMBER_WITH_FUNCTION_SFINAE \
- ( \
- ( BOOST_PP_ADD(VMD_DATA_SIZE(__VA_ARGS__),4), ( apply, name, 1, false, __VA_ARGS__ ) ) \
- ) \
+ typedef typename detail::trait<T>::type type; \
+ \
+ BOOST_STATIC_CONSTANT(bool,value=type::value); \
     }; \
   } \
 /**/
 
-#else // !!BOOST_WORKAROUND(BOOST_MSVC, <= 1400)
-
-/// Expands to a metafunction which tests whether an inner class template with a particular name and signature exists.
+/// Expands to a metafunction class which tests whether an inner class template with a particular name and signature exists.
 /**
 
- trait = the name of the metafunction within the tti namespace.<br />
+ trait = the name of the metafunction class within the tti namespace.<br />
     name = the name of the inner class template.<br />
     ... = variadic macro data which has the class template parameters.
 
- returns = a metafunction called "tti::trait" where 'trait' is the macro parameter.
+ returns = a metafunction class called "tti::trait" where 'trait' is the macro parameter.
     
- The metafunction types and return:
+ The metafunction class's 'apply' metafunction types and return:
     
                 T = the enclosing type in which to look for our 'name'.<br />
                 returns = 'value' is true if the 'name' class template, with the signature
@@ -82,37 +69,34 @@
                           otherwise 'value' is false.
     
 */
-#define TTI_VM_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,...) \
-namespace tti \
- { \
- TTI_DETAIL_HAS_MEMBER_WITH_TEMPLATE_SFINAE \
- ( \
- ( BOOST_PP_ADD(VMD_DATA_SIZE(__VA_ARGS__),4), ( trait, name, 1, false, __VA_ARGS__ ) ) \
- ) \
- } \
-/**/
-
 #define TTI_VM_MTFC_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,...) \
 namespace tti \
   { \
- TTI_DETAIL_MTFC_HAS_MEMBER_WITH_TEMPLATE_SFINAE \
- ( \
- ( BOOST_PP_ADD(VMD_DATA_SIZE(__VA_ARGS__),4), ( trait, name, 1, false, __VA_ARGS__ ) ) \
- ) \
+ namespace detail \
+ { \
+ TTI_VM_DETAIL_MTFC_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,__VA_ARGS__) \
+ } \
+ struct trait \
+ { \
+ template<class T> \
+ struct apply \
+ { \
+ typedef typename detail::trait::apply<T>::type type; \
+ \
+ BOOST_STATIC_CONSTANT(bool,value=type::value); \
+ }; \
+ }; \
   } \
 /**/
 
-#endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1400)
-#else // !!defined(BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE)
 
 /// Expands to a metafunction which tests whether an inner class template with a particular name and signature exists.
 /**
 
- trait = the name of the metafunction within the tti namespace.<br />
     name = the name of the inner class template.<br />
     ... = variadic macro data which has the class template parameters.
 
- returns = a metafunction called "tti::trait" where 'trait' is the macro parameter.
+ returns = a metafunction called "tti::has_template_check_params_name" where 'name' is the macro parameter.
     
               The metafunction types and return:
     
@@ -122,34 +106,24 @@
                           otherwise 'value' is false.
     
 */
-#define TTI_VM_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,...) \
-namespace tti \
- { \
- TTI_DETAIL_SAME(trait,name) \
- } \
-/**/
-
-#define TTI_VM_MTFC_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,...) \
-namespace tti \
- { \
- struct trait \
- { \
- TTI_DETAIL_SAME(apply,name) \
- }; \
- } \
+#define TTI_VM_HAS_TEMPLATE_CHECK_PARAMS(name,...) \
+ TTI_VM_TRAIT_HAS_TEMPLATE_CHECK_PARAMS \
+ ( \
+ BOOST_PP_CAT(has_template_check_params_,name), \
+ name, \
+ __VA_ARGS__ \
+ ) \
 /**/
 
-#endif // !defined(BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE)
-
-/// Expands to a metafunction which tests whether an inner class template with a particular name and signature exists.
+/// Expands to a metafunction class which tests whether an inner class template with a particular name and signature exists.
 /**
 
     name = the name of the inner class template.<br />
     ... = variadic macro data which has the class template parameters.
 
- returns = a metafunction called "tti::has_template_check_params_name" where 'name' is the macro parameter.
+ returns = a metafunction class called "tti::mtfc_has_template_check_params_name" where 'name' is the macro parameter.
     
- The metafunction types and return:
+ The metafunction class's 'apply' metafunction types and return:
     
                 T = the enclosing type in which to look for our 'name'.<br />
                 returns = 'value' is true if the 'name' class template, with the signature
@@ -157,15 +131,6 @@
                           otherwise 'value' is false.
     
 */
-#define TTI_VM_HAS_TEMPLATE_CHECK_PARAMS(name,...) \
- TTI_VM_TRAIT_HAS_TEMPLATE_CHECK_PARAMS \
- ( \
- BOOST_PP_CAT(has_template_check_params_,name), \
- name, \
- __VA_ARGS__ \
- ) \
-/**/
-
 #define TTI_VM_MTFC_HAS_TEMPLATE_CHECK_PARAMS(name,...) \
   TTI_VM_MTFC_TRAIT_HAS_TEMPLATE_CHECK_PARAMS \
   ( \

Modified: sandbox/tti/boost/tti/detail/TTIntrospectionDetail.hpp
==============================================================================
--- sandbox/tti/boost/tti/detail/TTIntrospectionDetail.hpp (original)
+++ sandbox/tti/boost/tti/detail/TTIntrospectionDetail.hpp 2011-02-08 20:49:48 EST (Tue, 08 Feb 2011)
@@ -8,23 +8,18 @@
 #include <boost/mpl/has_xxx.hpp>
 #include <boost/mpl/identity.hpp>
 #include <boost/mpl/int.hpp>
-#include <boost/mpl/not.hpp>
 #include <boost/mpl/push_front.hpp>
 #include <boost/mpl/quote.hpp>
-#include <boost/mpl/remove.hpp>
-#include <boost/mpl/transform.hpp>
-#include <boost/mpl/vector.hpp>
 #include <boost/preprocessor/arithmetic/add.hpp>
 #include <boost/preprocessor/arithmetic/sub.hpp>
 #include <boost/preprocessor/array/elem.hpp>
 #include <boost/preprocessor/array/size.hpp>
 #include <boost/preprocessor/cat.hpp>
-#include <boost/preprocessor/iteration/iterate.hpp>
 #include <boost/preprocessor/punctuation/comma_if.hpp>
 #include <boost/preprocessor/repetition/repeat.hpp>
 #include <boost/preprocessor/repetition/enum.hpp>
-#include <boost/preprocessor/repetition/enum_shifted.hpp>
-#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
+#include <boost/preprocessor/seq/enum.hpp>
+#include <boost/preprocessor/seq/size.hpp>
 #include <boost/function_types/function_type.hpp>
 #include <boost/function_types/is_member_object_pointer.hpp>
 #include <boost/function_types/member_function_pointer.hpp>
@@ -811,6 +806,146 @@
 
 #endif // defined(BOOST_MSVC)
 
+#if !defined(BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE)
+#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1400)
+
+#define TTI_DETAIL_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,tpSeq) \
+ TTI_DETAIL_HAS_MEMBER_WITH_FUNCTION_SFINAE \
+ ( \
+ ( BOOST_PP_ADD(BOOST_PP_SEQ_SIZE(tpSeq),4), ( trait, name, 1, false, BOOST_PP_SEQ_ENUM(tpSeq) ) ) \
+ ) \
+/**/
+
+#define TTI_DETAIL_MTFC_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,tpSeq) \
+ struct trait \
+ { \
+ TTI_DETAIL_HAS_MEMBER_WITH_FUNCTION_SFINAE \
+ ( \
+ ( BOOST_PP_ADD(BOOST_PP_SEQ_SIZE(tpSeq),4), ( apply, name, 1, false, BOOST_PP_SEQ_ENUM(tpSeq) ) ) \
+ ) \
+ }; \
+/**/
+
+#else // !!BOOST_WORKAROUND(BOOST_MSVC, <= 1400)
+
+#define TTI_DETAIL_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,tpSeq) \
+ TTI_DETAIL_HAS_MEMBER_WITH_TEMPLATE_SFINAE \
+ ( \
+ ( BOOST_PP_ADD(BOOST_PP_SEQ_SIZE(tpSeq),4), ( trait, name, 1, false, BOOST_PP_SEQ_ENUM(tpSeq) ) ) \
+ ) \
+/**/
+
+#define TTI_DETAIL_MTFC_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,tpSeq) \
+ TTI_DETAIL_MTFC_HAS_MEMBER_WITH_TEMPLATE_SFINAE \
+ ( \
+ ( BOOST_PP_ADD(BOOST_PP_SEQ_SIZE(tpSeq),4), ( trait, name, 1, false, BOOST_PP_SEQ_ENUM(tpSeq) ) ) \
+ ) \
+/**/
+
+#endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1400)
+#else // !!defined(BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE)
+
+#define TTI_DETAIL_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,tpSeq) \
+ TTI_DETAIL_SAME(trait,name) \
+/**/
+
+#define TTI_DETAIL_MTFC_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,tpSeq) \
+ struct trait \
+ { \
+ TTI_DETAIL_SAME(apply,name) \
+ }; \
+/**/
+
+#endif // !defined(BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE)
+
+#if defined(BOOST_NO_NULLPTR)
+
+#define TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER(trait,name) \
+ template<class T,class Type> \
+ struct trait \
+ { \
+ template<Type *> \
+ struct helper; \
+ \
+ template<class U> \
+ static ::boost::type_traits::yes_type check(helper<&U::name> *); \
+ \
+ template<class U> \
+ static ::boost::type_traits::no_type check(...); \
+ \
+ BOOST_STATIC_CONSTANT(bool,value=sizeof(check<T>(0))==sizeof(::boost::type_traits::yes_type)); \
+ \
+ typedef boost::mpl::bool_<value> type; \
+ }; \
+/**/
+
+#define TTI_DETAIL_MTFC_TRAIT_HAS_STATIC_MEMBER(trait,name) \
+ struct trait \
+ { \
+ template<class T,class Type> \
+ struct apply \
+ { \
+ template<Type *> \
+ struct helper; \
+ \
+ template<class U> \
+ static ::boost::type_traits::yes_type check(helper<&U::name> *); \
+ \
+ template<class U> \
+ static ::boost::type_traits::no_type check(...); \
+ \
+ BOOST_STATIC_CONSTANT(bool,value=sizeof(check<T>(0))==sizeof(::boost::type_traits::yes_type)); \
+ \
+ typedef boost::mpl::bool_<value> type; \
+ }; \
+ }; \
+/**/
+
+#else // !defined(BOOST_NO_NULLPTR)
+
+#define TTI_DETAIL_TRAIT_HAS_STATIC_MEMBER(trait,name) \
+ template<class T,class Type> \
+ struct trait \
+ { \
+ template<Type *> \
+ struct helper; \
+ \
+ template<class U> \
+ static ::boost::type_traits::yes_type check(helper<&U::name> *); \
+ \
+ template<class U> \
+ static ::boost::type_traits::no_type check(...); \
+ \
+ BOOST_STATIC_CONSTANT(bool,value=sizeof(check<T>(nullptr))==sizeof(::boost::type_traits::yes_type)); \
+ \
+ typedef boost::mpl::bool_<value> type; \
+ }; \
+/**/
+
+#define TTI_DETAIL_MTFC_TRAIT_HAS_STATIC_MEMBER(trait,name) \
+ struct trait \
+ { \
+ template<class T,class Type> \
+ struct apply \
+ { \
+ template<Type *> \
+ struct helper; \
+ \
+ template<class U> \
+ static ::boost::type_traits::yes_type check(helper<&U::name> *); \
+ \
+ template<class U> \
+ static ::boost::type_traits::no_type check(...); \
+ \
+ BOOST_STATIC_CONSTANT(bool,value=sizeof(check<T>(nullptr))==sizeof(::boost::type_traits::yes_type)); \
+ \
+ typedef boost::mpl::bool_<value> type; \
+ }; \
+ }; \
+/**/
+
+#endif // defined(BOOST_NO_NULLPTR)
+
 namespace tti
   {
   namespace detail

Added: sandbox/tti/boost/tti/detail/TTIntrospectionVMDetail.hpp
==============================================================================
--- (empty file)
+++ sandbox/tti/boost/tti/detail/TTIntrospectionVMDetail.hpp 2011-02-08 20:49:48 EST (Tue, 08 Feb 2011)
@@ -0,0 +1,67 @@
+#if !defined(TT_INTROSPECTION_VM_DETAIL_HPP)
+#define TT_INTROSPECTION_VM_DETAIL_HPP
+
+#include <boost/config.hpp>
+
+#if !defined(BOOST_NO_VARIADIC_MACROS)
+
+#include <boost/mpl/has_xxx.hpp>
+#include <boost/mpl/identity.hpp>
+#include <boost/preprocessor/arithmetic/add.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/variadic_macro_data/VariadicMacroData.hpp>
+#include "TTIntrospectionDetail.hpp"
+
+#if !defined(BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE)
+#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1400)
+
+#define TTI_VM_DETAIL_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,...) \
+ TTI_DETAIL_HAS_MEMBER_WITH_FUNCTION_SFINAE \
+ ( \
+ ( BOOST_PP_ADD(VMD_DATA_SIZE(__VA_ARGS__),4), ( trait, name, 1, false, __VA_ARGS__ ) ) \
+ ) \
+/**/
+
+#define TTI_VM_DETAIL_MTFC_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,...) \
+ struct trait \
+ { \
+ TTI_DETAIL_HAS_MEMBER_WITH_FUNCTION_SFINAE \
+ ( \
+ ( BOOST_PP_ADD(VMD_DATA_SIZE(__VA_ARGS__),4), ( apply, name, 1, false, __VA_ARGS__ ) ) \
+ ) \
+ }; \
+/**/
+
+#else // !!BOOST_WORKAROUND(BOOST_MSVC, <= 1400)
+
+#define TTI_VM_DETAIL_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,...) \
+ TTI_DETAIL_HAS_MEMBER_WITH_TEMPLATE_SFINAE \
+ ( \
+ ( BOOST_PP_ADD(VMD_DATA_SIZE(__VA_ARGS__),4), ( trait, name, 1, false, __VA_ARGS__ ) ) \
+ ) \
+/**/
+
+#define TTI_VM_DETAIL_MTFC_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,...) \
+ TTI_DETAIL_MTFC_HAS_MEMBER_WITH_TEMPLATE_SFINAE \
+ ( \
+ ( BOOST_PP_ADD(VMD_DATA_SIZE(__VA_ARGS__),4), ( trait, name, 1, false, __VA_ARGS__ ) ) \
+ ) \
+/**/
+
+#endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1400)
+#else // !!defined(BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE)
+
+#define TTI_VM_DETAIL_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,...) \
+ TTI_DETAIL_SAME(trait,name) \
+/**/
+
+#define TTI_VM_DETAIL_MTFC_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,...) \
+ struct trait \
+ { \
+ TTI_DETAIL_SAME(apply,name) \
+ }; \
+/**/
+
+#endif // !defined(BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE)
+#endif // !defined(BOOST_NO_VARIADIC_MACROS)
+#endif // TT_INTROSPECTION_VM_DETAIL_HPP


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