Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r69683 - in sandbox/tti: boost/tti/detail libs/tti/test
From: eldiener_at_[hidden]
Date: 2011-03-08 09:47:21


Author: eldiener
Date: 2011-03-08 09:47:18 EST (Tue, 08 Mar 2011)
New Revision: 69683
URL: http://svn.boost.org/trac/boost/changeset/69683

Log:
Composite member function only works with function pointer type.
Removed:
   sandbox/tti/libs/tti/test/test_has_member_fail3.cpp
   sandbox/tti/libs/tti/test/test_has_member_fail4.cpp
   sandbox/tti/libs/tti/test/test_has_member_fail5.cpp
   sandbox/tti/libs/tti/test/test_has_static_member_fail3.cpp
   sandbox/tti/libs/tti/test/test_has_static_member_fail4.cpp
Text files modified:
   sandbox/tti/boost/tti/detail/dcomp_mem_fun.hpp | 284 ---------------------------------------
   sandbox/tti/libs/tti/test/Jamfile.v2 | 5
   sandbox/tti/libs/tti/test/test_has_member.cpp | 10 -
   sandbox/tti/libs/tti/test/test_has_member.hpp | 8 -
   sandbox/tti/libs/tti/test/test_has_member_compile.cpp | 10 -
   sandbox/tti/libs/tti/test/test_has_member_fail.cpp | 4
   sandbox/tti/libs/tti/test/test_has_member_fail2.cpp | 5
   7 files changed, 9 insertions(+), 317 deletions(-)

Modified: sandbox/tti/boost/tti/detail/dcomp_mem_fun.hpp
==============================================================================
--- sandbox/tti/boost/tti/detail/dcomp_mem_fun.hpp (original)
+++ sandbox/tti/boost/tti/detail/dcomp_mem_fun.hpp 2011-03-08 09:47:18 EST (Tue, 08 Mar 2011)
@@ -1,59 +1,22 @@
-#if !defined(TTI_DETAIL_MEM_HPP)
-#define TTI_DETAIL_MEM_HPP
+#if !defined(TTI_DETAIL_COMP_MEM_FUN_HPP)
+#define TTI_DETAIL_COMP_MEM_FUN_HPP
 
 #include <boost/config.hpp>
 #include <boost/mpl/at.hpp>
 #include <boost/mpl/bool.hpp>
-#include <boost/mpl/eval_if.hpp>
 #include <boost/mpl/identity.hpp>
 #include <boost/mpl/int.hpp>
 #include <boost/mpl/quote.hpp>
-#include <boost/function_types/is_member_object_pointer.hpp>
 #include <boost/function_types/parameter_types.hpp>
 #include <boost/type_traits/remove_const.hpp>
 #include <boost/type_traits/detail/yes_no_type.hpp>
 
-#if defined(BOOST_MSVC)
-
 #if defined(BOOST_NO_NULLPTR)
 
 #define TTI_DETAIL_TRAIT_HAS_MEMBER(trait,name) \
   template<class T> \
   struct trait \
     { \
- template<class> \
- struct class_of; \
- \
- template<class R,class C> \
- struct class_of<R C::*> \
- { \
- typedef C type; \
- }; \
- \
- template<class> \
- struct return_of; \
- \
- template<class R,class C> \
- struct return_of<R C::*> \
- { \
- typedef R type; \
- }; \
- \
- template<bool,typename U> \
- struct menable_if; \
- \
- template<typename U> \
- struct menable_if<true,U> \
- { \
- typedef U type; \
- }; \
- \
- template<typename U,typename V> \
- static ::boost::type_traits::yes_type check2(V U::*); \
- \
- template<typename U,typename V> \
- static ::boost::type_traits::no_type check2(U); \
- \
     template<class F> \
     struct class_type \
       { \
@@ -82,54 +45,15 @@
     template<T> \
     struct helper; \
     \
- template<typename U,typename V> \
- static typename \
- menable_if \
- < \
- sizeof(check2<U,V>(&U::name))==sizeof(::boost::type_traits::yes_type), \
- ::boost::type_traits::yes_type \
- > \
- ::type \
- has_matching_member(int); \
- \
- template<typename U,typename V> \
- static ::boost::type_traits::no_type has_matching_member(...); \
- \
     template<class U> \
     static ::boost::type_traits::yes_type check(helper<&U::name> *); \
     \
     template<class U> \
     static ::boost::type_traits::no_type check(...); \
     \
- template<class F> \
- struct ttc_md \
- { \
- typedef boost::mpl::bool_<sizeof(has_matching_member<typename class_of<F>::type,typename return_of<F>::type>(0))==sizeof(::boost::type_traits::yes_type)> type; \
- }; \
- \
- template<class F> \
- struct ttc_mf \
- { \
- typedef boost::mpl::bool_<sizeof(check<typename class_type<F>::type>(0))==sizeof(::boost::type_traits::yes_type)> type; \
- }; \
- \
- template<class F> \
- struct type_to_check \
- { \
- typedef typename \
- boost::mpl::eval_if \
- < \
- boost::function_types::is_member_object_pointer<F>, \
- ttc_md<F>, \
- ttc_mf<F> \
- >::type \
- type; \
- }; \
- \
- typedef typename type_to_check<T>::type type; \
- \
- BOOST_STATIC_CONSTANT(bool,value=type::value); \
+ BOOST_STATIC_CONSTANT(bool,value=sizeof(check<typename class_type<T>::type>(0))==sizeof(::boost::type_traits::yes_type)); \
     \
+ typedef boost::mpl::bool_<value> type; \
     }; \
 /**/
 
@@ -139,39 +63,6 @@
   template<class T> \
   struct trait \
     { \
- template<class> \
- struct class_of; \
- \
- template<class R,class C> \
- struct class_of<R C::*> \
- { \
- typedef C type; \
- }; \
- \
- template<class> \
- struct return_of; \
- \
- template<class R,class C> \
- struct return_of<R C::*> \
- { \
- typedef R type; \
- }; \
- \
- template<bool,typename U> \
- struct menable_if; \
- \
- template<typename U> \
- struct menable_if<true,U> \
- { \
- typedef U type; \
- }; \
- \
- template<typename U,typename V> \
- static ::boost::type_traits::yes_type check2(V U::*); \
- \
- template<typename U,typename V> \
- static ::boost::type_traits::no_type check2(U); \
- \
     template<class F> \
     struct class_type \
       { \
@@ -200,169 +91,6 @@
     template<T> \
     struct helper; \
     \
- template<typename U,typename V> \
- static typename \
- menable_if \
- < \
- sizeof(check2<U,V>(&U::name))==sizeof(::boost::type_traits::yes_type), \
- ::boost::type_traits::yes_type \
- > \
- ::type \
- has_matching_member(int); \
- \
- template<typename U,typename V> \
- static ::boost::type_traits::no_type has_matching_member(...); \
- \
- template<class U> \
- static ::boost::type_traits::yes_type check(helper<&U::name> *); \
- \
- template<class U> \
- static ::boost::type_traits::no_type check(...); \
- \
- template<class F> \
- struct ttc_md \
- { \
- typedef boost::mpl::bool_<sizeof(has_matching_member<typename class_of<F>::type,typename return_of<F>::type>(0))==sizeof(::boost::type_traits::yes_type)> type; \
- }; \
- \
- template<class F> \
- struct ttc_mf \
- { \
- typedef boost::mpl::bool_<sizeof(check<typename class_type<F>::type>(nullptr))==sizeof(::boost::type_traits::yes_type)> type; \
- }; \
- \
- template<class F> \
- struct type_to_check \
- { \
- typedef typename \
- boost::mpl::eval_if \
- < \
- boost::function_types::is_member_object_pointer<F>, \
- ttc_md<F>, \
- ttc_mf<F> \
- >::type \
- type; \
- }; \
- \
- typedef typename type_to_check<T>::type type; \
- \
- BOOST_STATIC_CONSTANT(bool,value=type::value); \
- \
- }; \
-/**/
-
-#endif // defined(BOOST_NO_NULLPTR)
-
-#else // !defined(BOOST_MSVC)
-
-#if defined(BOOST_NO_NULLPTR)
-
-#define TTI_DETAIL_TRAIT_HAS_MEMBER(trait,name) \
- template<class T> \
- struct trait \
- { \
- template<class> \
- struct class_of; \
- \
- template<class R,class C> \
- struct class_of<R C::*> \
- { \
- typedef C type; \
- }; \
- \
- template<class F> \
- struct class_type \
- { \
- typedef typename \
- boost::mpl::eval_if \
- < \
- boost::function_types::is_member_object_pointer<F>, \
- class_of<F>, \
- boost::remove_const \
- < \
- typename \
- boost::mpl::at \
- < \
- typename \
- boost::function_types::parameter_types \
- < \
- F, \
- boost::mpl::quote1 \
- < \
- boost::mpl::identity \
- > \
- > \
- ::type, \
- boost::mpl::int_<0> \
- >::type \
- > \
- >::type \
- type; \
- }; \
- \
- template<T> \
- 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<typename class_type<T>::type>(0))==sizeof(::boost::type_traits::yes_type)); \
- \
- typedef boost::mpl::bool_<value> type; \
- }; \
-/**/
-
-#else // !defined(BOOST_NO_NULLPTR)
-
-#define TTI_DETAIL_TRAIT_HAS_MEMBER(trait,name) \
- template<class T> \
- struct trait \
- { \
- template<class> \
- struct class_of; \
- \
- template<class R,class C> \
- struct class_of<R C::*> \
- { \
- typedef C type; \
- }; \
- \
- template<class F> \
- struct class_type \
- { \
- typedef typename \
- boost::mpl::eval_if \
- < \
- boost::function_types::is_member_object_pointer<F>, \
- class_of<F>, \
- boost::remove_const \
- < \
- typename \
- boost::mpl::at \
- < \
- typename \
- boost::function_types::parameter_types \
- < \
- F, \
- boost::mpl::quote1 \
- < \
- boost::mpl::identity \
- > \
- > \
- ::type, \
- boost::mpl::int_<0> \
- >::type \
- > \
- >::type \
- type; \
- }; \
- \
- template<T> \
- struct helper; \
- \
     template<class U> \
     static ::boost::type_traits::yes_type check(helper<&U::name> *); \
     \
@@ -377,6 +105,4 @@
 
 #endif // defined(BOOST_NO_NULLPTR)
 
-#endif // defined(BOOST_MSVC)
-
-#endif // TTI_DETAIL_MEM_HPP
+#endif // TTI_DETAIL_COMP_MEM_FUN_HPP

Modified: sandbox/tti/libs/tti/test/Jamfile.v2
==============================================================================
--- sandbox/tti/libs/tti/test/Jamfile.v2 (original)
+++ sandbox/tti/libs/tti/test/Jamfile.v2 2011-03-08 09:47:18 EST (Tue, 08 Mar 2011)
@@ -25,9 +25,6 @@
         [ compile test_has_member_compile.cpp ]
         [ compile-fail test_has_member_fail.cpp ]
         [ compile-fail test_has_member_fail2.cpp ]
- [ compile-fail test_has_member_fail3.cpp ]
- [ compile-fail test_has_member_fail4.cpp ]
- [ compile-fail test_has_member_fail5.cpp ]
         [ run test_has_mem_data.cpp ]
         [ compile test_has_mem_data_compile.cpp ]
         [ compile-fail test_has_mem_data_fail.cpp ]
@@ -45,8 +42,6 @@
         [ compile test_has_static_member_compile.cpp ]
         [ compile-fail test_has_static_member_fail.cpp ]
         [ compile-fail test_has_static_member_fail2.cpp ]
- [ compile-fail test_has_static_member_fail3.cpp ]
- [ compile-fail test_has_static_member_fail4.cpp ]
         [ run test_has_static_mem_data.cpp ]
         [ compile test_has_static_mem_data_compile.cpp ]
         [ compile-fail test_has_static_mem_data_fail.cpp ]

Modified: sandbox/tti/libs/tti/test/test_has_member.cpp
==============================================================================
--- sandbox/tti/libs/tti/test/test_has_member.cpp (original)
+++ sandbox/tti/libs/tti/test/test_has_member.cpp 2011-03-08 09:47:18 EST (Tue, 08 Mar 2011)
@@ -4,23 +4,13 @@
 int main()
   {
   
- BOOST_TEST(boost::tti::has_member_AnInt<int AType::*>::value);
- BOOST_TEST(boost::tti::has_member_AnInt<long AnotherType::*>::value);
   BOOST_TEST(boost::tti::has_member_VoidFunction<void (AType::*)()>::value);
   BOOST_TEST(boost::tti::FunctionReturningInt<int (AType::*)()>::value);
   BOOST_TEST(boost::tti::FunctionReturningInt<double (AnotherType::*)(int)>::value);
   BOOST_TEST(boost::tti::has_member_aFunction<AType (AnotherType::*)(int)>::value);
   BOOST_TEST(boost::tti::AnotherIntFunction<int (AnotherType::*)(AType)>::value);
   BOOST_TEST(boost::tti::has_member_sFunction<AType::AnIntType (AnotherType::*)(int,long,double)>::value);
- BOOST_TEST(boost::tti::has_member_aMember<bool AnotherType::*>::value);
- BOOST_TEST(!boost::tti::has_member_aMember<int AnotherType::*>::value);
- BOOST_TEST(boost::tti::CMember<bool AnotherType::*>::value);
- BOOST_TEST(!boost::tti::has_member_someDataMember<short AType::*>::value);
   BOOST_TEST(!boost::tti::has_member_someFunctionMember<AType (AnotherType::*)(long,int)>::value);
- BOOST_TEST(boost::tti::has_member_IntBT<AType::BType AType::*>::value);
- BOOST_TEST(boost::tti::NestedData<AType::BType::CType AType::*>::value);
- BOOST_TEST(boost::tti::AOther<AType AnotherType::*>::value);
- BOOST_TEST(boost::tti::has_member_ONestStr<AType::AStructType AnotherType::*>::value);
   
   return boost::report_errors();
 

Modified: sandbox/tti/libs/tti/test/test_has_member.hpp
==============================================================================
--- sandbox/tti/libs/tti/test/test_has_member.hpp (original)
+++ sandbox/tti/libs/tti/test/test_has_member.hpp 2011-03-08 09:47:18 EST (Tue, 08 Mar 2011)
@@ -4,19 +4,11 @@
 #include "test_structs.hpp"
 #include <boost/tti/comp_mem_fun.hpp>
 
-BOOST_TTI_HAS_MEMBER(AnInt)
 BOOST_TTI_HAS_MEMBER(VoidFunction)
 BOOST_TTI_TRAIT_HAS_MEMBER(FunctionReturningInt,IntFunction)
 BOOST_TTI_HAS_MEMBER(aFunction)
 BOOST_TTI_TRAIT_HAS_MEMBER(AnotherIntFunction,anotherFunction)
 BOOST_TTI_HAS_MEMBER(sFunction)
-BOOST_TTI_HAS_MEMBER(aMember)
-BOOST_TTI_TRAIT_HAS_MEMBER(CMember,cMem)
-BOOST_TTI_HAS_MEMBER(someDataMember)
 BOOST_TTI_HAS_MEMBER(someFunctionMember)
-BOOST_TTI_HAS_MEMBER(IntBT)
-BOOST_TTI_TRAIT_HAS_MEMBER(NestedData,NestedCT)
-BOOST_TTI_TRAIT_HAS_MEMBER(AOther,OtherAT)
-BOOST_TTI_HAS_MEMBER(ONestStr)
 
 #endif // TEST_HAS_MEMBER_HPP

Modified: sandbox/tti/libs/tti/test/test_has_member_compile.cpp
==============================================================================
--- sandbox/tti/libs/tti/test/test_has_member_compile.cpp (original)
+++ sandbox/tti/libs/tti/test/test_has_member_compile.cpp 2011-03-08 09:47:18 EST (Tue, 08 Mar 2011)
@@ -6,26 +6,16 @@
   
   // You can always instantiate without compiler errors
   
- boost::tti::has_member_aMember<long AType::*> aVar;
- boost::tti::has_member_someDataMember<double AnotherType::*> aVar2;
   boost::tti::has_member_someFunctionMember<double (AnotherType::*)(short,short,long,int)> aVar3;
   
   // Compile time asserts
   
- BOOST_MPL_ASSERT((boost::tti::has_member_AnInt<int AType::*>));
- BOOST_MPL_ASSERT((boost::tti::has_member_AnInt<long AnotherType::*>));
   BOOST_MPL_ASSERT((boost::tti::has_member_VoidFunction<void (AType::*)()>));
   BOOST_MPL_ASSERT((boost::tti::FunctionReturningInt<int (AType::*)()>));
   BOOST_MPL_ASSERT((boost::tti::FunctionReturningInt<double (AnotherType::*)(int)>));
   BOOST_MPL_ASSERT((boost::tti::has_member_aFunction<AType (AnotherType::*)(int)>));
   BOOST_MPL_ASSERT((boost::tti::AnotherIntFunction<int (AnotherType::*)(AType)>));
   BOOST_MPL_ASSERT((boost::tti::has_member_sFunction<AType::AnIntType (AnotherType::*)(int,long,double)>));
- BOOST_MPL_ASSERT((boost::tti::has_member_aMember<bool AnotherType::*>));
- BOOST_MPL_ASSERT((boost::tti::CMember<bool AnotherType::*>));
- BOOST_MPL_ASSERT((boost::tti::has_member_IntBT<AType::BType AType::*>));
- BOOST_MPL_ASSERT((boost::tti::NestedData<AType::BType::CType AType::*>));
- BOOST_MPL_ASSERT((boost::tti::AOther<AType AnotherType::*>));
- BOOST_MPL_ASSERT((boost::tti::has_member_ONestStr<AType::AStructType AnotherType::*>));
   
   return 0;
 

Modified: sandbox/tti/libs/tti/test/test_has_member_fail.cpp
==============================================================================
--- sandbox/tti/libs/tti/test/test_has_member_fail.cpp (original)
+++ sandbox/tti/libs/tti/test/test_has_member_fail.cpp 2011-03-08 09:47:18 EST (Tue, 08 Mar 2011)
@@ -4,9 +4,9 @@
 int main()
   {
   
- // someDataMember does not exist at all
+ // Wrong function signature for sFunction
   
- BOOST_MPL_ASSERT(( boost::tti::has_member_someDataMember<short AType::*> ));
+ BOOST_MPL_ASSERT(( boost::tti::has_member_sFunction<AType::AnIntType (AnotherType::*)(short,long,double)> ));
   
   return 0;
 

Modified: sandbox/tti/libs/tti/test/test_has_member_fail2.cpp
==============================================================================
--- sandbox/tti/libs/tti/test/test_has_member_fail2.cpp (original)
+++ sandbox/tti/libs/tti/test/test_has_member_fail2.cpp 2011-03-08 09:47:18 EST (Tue, 08 Mar 2011)
@@ -1,12 +1,11 @@
 #include "test_has_member.hpp"
-#include <boost/mpl/assert.hpp>
 
 int main()
   {
   
- // Wrong data signature for aMember
+ // Function signature has type which does not exist
   
- BOOST_MPL_ASSERT(( boost::tti::has_member_aMember<int AnotherType::*> ));
+ boost::tti::has_member_sFunction<AType::AnIntType (NVType::*)(short,long,double)> aVar;
   
   return 0;
 

Deleted: sandbox/tti/libs/tti/test/test_has_member_fail3.cpp
==============================================================================
--- sandbox/tti/libs/tti/test/test_has_member_fail3.cpp 2011-03-08 09:47:18 EST (Tue, 08 Mar 2011)
+++ (empty file)
@@ -1,13 +0,0 @@
-#include "test_has_member.hpp"
-#include <boost/mpl/assert.hpp>
-
-int main()
- {
-
- // Wrong function signature for sFunction
-
- BOOST_MPL_ASSERT(( boost::tti::has_member_sFunction<AType::AnIntType (AnotherType::*)(short,long,double)> ));
-
- return 0;
-
- }

Deleted: sandbox/tti/libs/tti/test/test_has_member_fail4.cpp
==============================================================================
--- sandbox/tti/libs/tti/test/test_has_member_fail4.cpp 2011-03-08 09:47:18 EST (Tue, 08 Mar 2011)
+++ (empty file)
@@ -1,12 +0,0 @@
-#include "test_has_member.hpp"
-
-int main()
- {
-
- // Data signature has type which does not exist
-
- boost::tti::has_member_aMember<AType::NTHType AnotherType::*> aVar;
-
- return 0;
-
- }

Deleted: sandbox/tti/libs/tti/test/test_has_member_fail5.cpp
==============================================================================
--- sandbox/tti/libs/tti/test/test_has_member_fail5.cpp 2011-03-08 09:47:18 EST (Tue, 08 Mar 2011)
+++ (empty file)
@@ -1,12 +0,0 @@
-#include "test_has_member.hpp"
-
-int main()
- {
-
- // Function signature has type which does not exist
-
- boost::tti::has_member_sFunction<AType::AnIntType (NVType::*)(short,long,double)> aVar;
-
- return 0;
-
- }

Deleted: sandbox/tti/libs/tti/test/test_has_static_member_fail3.cpp
==============================================================================
--- sandbox/tti/libs/tti/test/test_has_static_member_fail3.cpp 2011-03-08 09:47:18 EST (Tue, 08 Mar 2011)
+++ (empty file)
@@ -1,13 +0,0 @@
-#include "test_has_static_member.hpp"
-#include <boost/mpl/assert.hpp>
-
-int main()
- {
-
- // Wrong function signature for SIntFunction
-
- BOOST_MPL_ASSERT((boost::tti::HaveTheSIntFunction<AType,int (float,double)>));
-
- return 0;
-
- }

Deleted: sandbox/tti/libs/tti/test/test_has_static_member_fail4.cpp
==============================================================================
--- sandbox/tti/libs/tti/test/test_has_static_member_fail4.cpp 2011-03-08 09:47:18 EST (Tue, 08 Mar 2011)
+++ (empty file)
@@ -1,12 +0,0 @@
-#include "test_has_static_member.hpp"
-
-int main()
- {
-
- // Function signature has type which does not exist
-
- boost::tti::has_static_member_TSFunction<AnotherType,AType::AClassType (AType::AnIntType,double)> aVar;
-
- return 0;
-
- }


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