Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67050 - in sandbox/tti/boost/tti: . detail
From: eldiener_at_[hidden]
Date: 2010-12-05 17:41:14


Author: eldiener
Date: 2010-12-05 17:41:12 EST (Sun, 05 Dec 2010)
New Revision: 67050
URL: http://svn.boost.org/trac/boost/changeset/67050

Log:
Updated to provide a cleaner mf implementation
Text files modified:
   sandbox/tti/boost/tti/TTIntrospection.hpp | 297 +++++++--------------------------------
   sandbox/tti/boost/tti/detail/TTIntrospectionDetail.hpp | 31 ++-
   2 files changed, 71 insertions(+), 257 deletions(-)

Modified: sandbox/tti/boost/tti/TTIntrospection.hpp
==============================================================================
--- sandbox/tti/boost/tti/TTIntrospection.hpp (original)
+++ sandbox/tti/boost/tti/TTIntrospection.hpp 2010-12-05 17:41:12 EST (Sun, 05 Dec 2010)
@@ -45,36 +45,6 @@
   ) \
 /**/
 
-#define TTI_TRAIT_MFT_HAS_TYPE(trait,name) \
-namespace tti \
- { \
- namespace detail \
- { \
- TTI_DETAIL_TRAIT_HAS_TYPE(trait,name) \
- } \
- template<class T> \
- struct trait \
- { \
- typedef typename \
- tti::detail::eval \
- < \
- tti::detail::trait<T> \
- >::type \
- type; \
- \
- BOOST_STATIC_CONSTANT(bool,value=type::value); \
- }; \
- } \
-/**/
-
-#define TTI_MFT_HAS_TYPE(name) \
- TTI_TRAIT_MFT_HAS_TYPE \
- ( \
- BOOST_PP_CAT(mft_has_type_,name), \
- name \
- ) \
-/**/
-
 #define TTI_TRAIT_MEMBER_TYPE(trait,name) \
 namespace tti \
   { \
@@ -106,43 +76,6 @@
   ) \
 /**/
   
-#define TTI_TRAIT_MFT_MEMBER_TYPE(trait,name) \
-namespace tti \
- { \
- namespace detail \
- { \
- TTI_DETAIL_TRAIT_HAS_TYPE(trait,name) \
- TTI_DETAIL_TRAIT_MEMBER_TYPE(trait,name) \
- } \
- template<class T> \
- struct trait \
- { \
- typedef typename \
- boost::mpl::eval_if \
- < \
- tti::detail::eval \
- < \
- tti::detail::trait<T> \
- >, \
- tti::detail::eval \
- < \
- tti::detail::member_type::trait<T> \
- >, \
- tti::detail::notype \
- >::type \
- type; \
- }; \
- } \
-/**/
-
-#define TTI_MFT_MEMBER_TYPE(name) \
- TTI_TRAIT_MFT_MEMBER_TYPE \
- ( \
- BOOST_PP_CAT(mft_member_type_,name), \
- name \
- ) \
-/**/
-
 #define TTI_TRAIT_HAS_TYPE_CHECK_TYPEDEF(trait,name) \
 namespace tti \
   { \
@@ -196,63 +129,6 @@
   ) \
 /**/
 
-#define TTI_TRAIT_MFT_HAS_TYPE_CHECK_TYPEDEF(trait,name) \
-namespace tti \
- { \
- namespace detail \
- { \
- BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(trait, name, false) \
- } \
- \
- template<class T,class U,class B> \
- struct BOOST_PP_CAT(trait,_impl) \
- { \
- typedef typename \
- boost::mpl::eval_if \
- < \
- boost::is_same<typename T::type::name,U>, \
- boost::mpl::true_, \
- boost::mpl::false_ \
- >::type \
- type; \
- }; \
- \
- template<class T,class U> \
- struct BOOST_PP_CAT(trait,_impl)<T,U,boost::mpl::false_::type> \
- { \
- typedef boost::mpl::false_::type type; \
- }; \
- \
- template<class T,class U> \
- struct trait \
- { \
- \
- typedef typename \
- BOOST_PP_CAT(trait,_impl) \
- < \
- T, \
- U, \
- typename \
- tti::detail::eval \
- < \
- tti::detail::trait<T> \
- >::type \
- >::type \
- type; \
- \
- BOOST_STATIC_CONSTANT(bool,value=type::value); \
- }; \
- } \
-/**/
-
-#define TTI_MFT_HAS_TYPE_CHECK_TYPEDEF(name) \
- TTI_TRAIT_MFT_HAS_TYPE_CHECK_TYPEDEF \
- ( \
- BOOST_PP_CAT(mft_has_type_check_typedef_,name), \
- name \
- ) \
-/**/
-
 #define TTI_TRAIT_HAS_TEMPLATE(trait,name) \
 namespace tti \
   { \
@@ -280,6 +156,7 @@
 
 #if !defined(BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE)
 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1400)
+
 #define TTI_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,tpSeq) \
 namespace tti \
   { \
@@ -289,7 +166,9 @@
     ) \
   } \
 /**/
+
 #if !defined(BOOST_NO_VARIADIC_MACROS)
+
 #define TTI_VM_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,...) \
 namespace tti \
   { \
@@ -299,8 +178,10 @@
     ) \
   } \
 /**/
+
 #endif // !defined(BOOST_NO_VARIADIC_MACROS)
-#else
+#else // !!BOOST_WORKAROUND(BOOST_MSVC, <= 1400)
+
 #define TTI_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,tpSeq) \
 namespace tti \
   { \
@@ -310,7 +191,9 @@
     ) \
   } \
 /**/
+
 #if !defined(BOOST_NO_VARIADIC_MACROS)
+
 #define TTI_VM_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,...) \
 namespace tti \
   { \
@@ -320,16 +203,21 @@
     ) \
   } \
 /**/
+
 #endif // !defined(BOOST_NO_VARIADIC_MACROS)
 #endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1400)
-#else
+#else // !!defined(BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE)
+
 #define TTI_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,tpSeq) \
 TTI_DETAIL_SAME(trait,name) \
 /**/
+
 #if !defined(BOOST_NO_VARIADIC_MACROS)
+
 #define TTI_VM_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,...) \
 TTI_DETAIL_SAME(trait,name) \
 /**/
+
 #endif // !defined(BOOST_NO_VARIADIC_MACROS)
 #endif // !defined(BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE)
 
@@ -341,7 +229,9 @@
   tpSeq \
   ) \
 /**/
+
 #if !defined(BOOST_NO_VARIADIC_MACROS)
+
 #define TTI_VM_HAS_TEMPLATE_CHECK_PARAMS(name,...) \
   TTI_VM_TRAIT_HAS_TEMPLATE_CHECK_PARAMS \
   ( \
@@ -350,9 +240,10 @@
   __VA_ARGS__ \
   ) \
 /**/
-#endif
 
+#endif // !defined(BOOST_NO_VARIADIC_MACROS)
 #if defined(BOOST_NO_NULLPTR)
+
 #define TTI_TRAIT_HAS_MEMBER(trait,name) \
 namespace tti \
   { \
@@ -413,7 +304,9 @@
     }; \
   } \
 /**/
-#else
+
+#else // !!defined(BOOST_NO_NULLPTR)
+
 #define TTI_TRAIT_HAS_MEMBER(trait,name) \
 namespace tti \
   { \
@@ -474,7 +367,8 @@
     }; \
   } \
 /**/
-#endif
+
+#endif // defined(BOOST_NO_NULLPTR)
 
 #define TTI_HAS_MEMBER(name) \
   TTI_TRAIT_HAS_MEMBER \
@@ -485,6 +379,7 @@
 /**/
 
 #if defined(BOOST_NO_NULLPTR)
+
 #define TTI_TRAIT_HAS_STATIC_MEMBER(trait,name) \
 namespace tti \
   { \
@@ -506,7 +401,9 @@
     }; \
   } \
 /**/
-#else
+
+#else // !defined(BOOST_NO_NULLPTR)
+
 #define TTI_TRAIT_HAS_STATIC_MEMBER(trait,name) \
 namespace tti \
   { \
@@ -528,7 +425,8 @@
     }; \
   } \
 /**/
-#endif
+
+#endif // defined(BOOST_NO_NULLPTR)
   
 #define TTI_HAS_STATIC_MEMBER(name) \
   TTI_TRAIT_HAS_STATIC_MEMBER \
@@ -543,25 +441,15 @@
   
   template
     <
- class T,
- template<class> class HasMember,
- class R,
- BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(TTI_MAX_PARAMETERS,class P,tti::detail::noparam)
+ template<class> class HasType,
+ class T
>
- struct mf_has_member_function :
+ struct mf_has_type :
     tti::detail::eval
       <
- HasMember
+ HasType
         <
- tti::detail::eval
- <
- tti::detail::ptmf
- <
- boost::mpl::identity<T>,
- R,
- BOOST_PP_ENUM_PARAMS(TTI_MAX_PARAMETERS,P)
- >
- >
+ T
>
>
     {
@@ -569,12 +457,22 @@
     
   template
     <
- class T,
+ template<class> class MemberType,
+ class T
+ >
+ struct mf_member_type :
+ public mf_has_type<MemberType,T>
+ {
+ };
+
+ template
+ <
     template<class> class HasMember,
+ class T,
     class R,
     BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(TTI_MAX_PARAMETERS,class P,tti::detail::noparam)
>
- struct mf_mft_has_member_function :
+ struct mf_has_member_function :
     tti::detail::eval
       <
       HasMember
@@ -595,35 +493,11 @@
     
   template
     <
- class T,
     template<class> class HasMember,
- class R
- >
- struct mf_has_member_data :
- tti::detail::eval
- <
- HasMember
- <
- tti::detail::eval
- <
- tti::detail::ptmd
- <
- boost::mpl::identity<T>,
- R
- >
- >
- >
- >
- {
- };
-
- template
- <
     class T,
- template<class> class HasMember,
     class R
>
- struct mf_mft_has_member_data :
+ struct mf_has_member_data :
     tti::detail::eval
       <
       HasMember
@@ -643,38 +517,12 @@
     
   template
     <
- class T,
     template<class,class> class HasStaticMember,
- class R,
- BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(TTI_MAX_PARAMETERS,class P,tti::detail::noparam)
- >
- struct mf_has_static_function :
- tti::detail::eval
- <
- HasStaticMember
- <
- boost::mpl::identity<T>,
- tti::detail::eval
- <
- tti::detail::tfunction
- <
- R,
- BOOST_PP_ENUM_PARAMS(TTI_MAX_PARAMETERS,P)
- >
- >
- >
- >
- {
- };
-
- template
- <
     class T,
- template<class,class> class HasStaticMember,
     class R,
     BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(TTI_MAX_PARAMETERS,class P,tti::detail::noparam)
>
- struct mf_mft_has_static_function :
+ struct mf_has_static_function :
     tti::detail::eval
       <
       HasStaticMember
@@ -695,47 +543,17 @@
     
   template
     <
- class T,
     template<class,class> class HasStaticMember,
- class R
- >
- struct mf_has_static_data :
- tti::detail::eval
- <
- HasStaticMember
- <
- boost::mpl::identity<T>,
- tti::detail::eval
- <
- tti::detail::tdata
- <
- R
- >
- >
- >
- >
- {
- };
-
- template
- <
     class T,
- template<class,class> class HasStaticMember,
     class R
>
- struct mf_mft_has_static_data :
+ struct mf_has_static_data :
     tti::detail::eval
       <
       HasStaticMember
         <
         T,
- tti::detail::eval
- <
- tti::detail::tdata
- <
- R
- >
- >
+ R
>
>
     {
@@ -743,23 +561,12 @@
     
   template
     <
- class T,
     template<class,class> class HasTypeCheckTypedef,
- class U
- >
- struct mf_has_type_check_typedef :
- public mf_has_static_data<T,HasTypeCheckTypedef,U>
- {
- };
-
- template
- <
     class T,
- template<class,class> class HasTypeCheckTypedef,
     class U
>
- struct mf_mft_has_type_check_typedef :
- public mf_mft_has_static_data<T,HasTypeCheckTypedef,U>
+ struct mf_has_type_check_typedef :
+ public mf_has_static_data<HasTypeCheckTypedef,T,U>
     {
     };
     

Modified: sandbox/tti/boost/tti/detail/TTIntrospectionDetail.hpp
==============================================================================
--- sandbox/tti/boost/tti/detail/TTIntrospectionDetail.hpp (original)
+++ sandbox/tti/boost/tti/detail/TTIntrospectionDetail.hpp 2010-12-05 17:41:12 EST (Sun, 05 Dec 2010)
@@ -23,9 +23,11 @@
 #include <boost/function_types/function_type.hpp>
 
 #if !defined(BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE)
+
 #define TTI_DETAIL_TEMPLATE_PARAMETERS(z,n,args) \
 BOOST_PP_ARRAY_ELEM(BOOST_PP_ADD(4,n),args) \
 /**/
+
 #define TTI_DETAIL_HAS_MEMBER_IMPLEMENTATION(args,introspect_macro) \
    template \
      < \
@@ -45,7 +47,9 @@
>::type type; \
      }; \
 /**/
+
 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1400)
+
 #define TTI_DETAIL_HAS_MEMBER_MULTI_SUBSTITUTE(z,n,args) \
   template \
     < \
@@ -68,6 +72,7 @@
     { \
     }; \
 /**/
+
 #define TTI_DETAIL_HAS_MEMBER_SUBSTITUTE(args) \
   BOOST_PP_REPEAT \
     ( \
@@ -76,6 +81,7 @@
     args \
     ) \
 /**/
+
 #define TTI_DETAIL_HAS_MEMBER_INTROSPECT(args) \
   template< typename U > \
   struct BOOST_MPL_HAS_MEMBER_INTROSPECTION_NAME(args) \
@@ -90,6 +96,7 @@
     typedef boost::mpl::bool_< value > type; \
     }; \
 /**/
+
 #define TTI_DETAIL_HAS_MEMBER_WITH_FUNCTION_SFINAE(args) \
   TTI_DETAIL_HAS_MEMBER_IMPLEMENTATION \
     ( \
@@ -97,7 +104,9 @@
     TTI_DETAIL_HAS_MEMBER_INTROSPECT \
     ) \
 /**/
-#else
+
+#else // !!BOOST_WORKAROUND(BOOST_MSVC, <= 1400)
+
 #define TTI_DETAIL_HAS_MEMBER_MULTI_SUBSTITUTE_WITH_TEMPLATE_SFINAE(z,n,args) \
   template \
     < \
@@ -127,6 +136,7 @@
       type; \
     }; \
 /**/
+
 #define TTI_DETAIL_HAS_MEMBER_SUBSTITUTE_WITH_TEMPLATE_SFINAE(args) \
   typedef void \
       BOOST_MPL_HAS_MEMBER_INTROSPECTION_SUBSTITUTE_TAG_NAME(args); \
@@ -137,6 +147,7 @@
     args \
     ) \
 /**/
+
 #define TTI_DETAIL_HAS_MEMBER_INTROSPECT_WITH_TEMPLATE_SFINAE(args) \
   BOOST_MPL_HAS_MEMBER_REJECT_WITH_TEMPLATE_SFINAE(args,BOOST_PP_NIL) \
   BOOST_MPL_HAS_MEMBER_ACCEPT_WITH_TEMPLATE_SFINAE(args,BOOST_PP_NIL) \
@@ -145,6 +156,7 @@
       : BOOST_MPL_HAS_MEMBER_INTROSPECTION_TEST_NAME(args)< U > { \
   }; \
 /**/
+
 #define TTI_DETAIL_HAS_MEMBER_WITH_TEMPLATE_SFINAE(args) \
   TTI_DETAIL_HAS_MEMBER_SUBSTITUTE_WITH_TEMPLATE_SFINAE \
     ( \
@@ -156,8 +168,10 @@
     TTI_DETAIL_HAS_MEMBER_INTROSPECT_WITH_TEMPLATE_SFINAE \
     ) \
 /**/
-#endif
-#else
+
+#endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1400)
+#else // !!defined(BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE)
+
 #define TTI_DETAIL_SAME(trait,name) \
 namespace tti \
   { \
@@ -169,7 +183,8 @@
     ) \
   } \
 /**/
-#endif
+
+#endif // !defined(BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE)
 
 #define TTI_DETAIL_TRAIT_HAS_TYPE(trait,name) \
 namespace mpl \
@@ -263,14 +278,6 @@
       typedef typename boost::function_types::function_type<ftseq>::type type;
       };
       
- template
- <
- class R
- >
- struct tdata
- {
- typedef R type;
- };
     }
   }
   


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