From 6774d05f702210d15ae0e35d9ac71c1ec9a22534 Mon Sep 17 00:00:00 2001 From: mat007 Date: Tue, 24 Jul 2012 07:08:43 +0000 Subject: [PATCH] Refactored is_functor to use MPL has_xxx git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@530 860be788-9bd5-4423-9f1e-828f051e677b --- turtle/detail/is_functor.hpp | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/turtle/detail/is_functor.hpp b/turtle/detail/is_functor.hpp index 7a4d6f4..a7db376 100644 --- a/turtle/detail/is_functor.hpp +++ b/turtle/detail/is_functor.hpp @@ -11,6 +11,7 @@ #include "yes_no_type.hpp" #include +#include #include #include @@ -18,21 +19,9 @@ namespace mock { namespace detail { -#define MOCK_IS_FUNCTION_HELPER(N, M) \ - template< typename T > yes_type& N##_helper( \ - BOOST_DEDUCED_TYPENAME T::M* ); \ - template< typename T > no_type& N##_helper( ... ); \ - template< typename T > struct N \ - : boost::mpl::bool_< \ - sizeof( N##_helper< T >( 0 ) ) == sizeof( yes_type ) \ - > \ - {}; - - MOCK_IS_FUNCTION_HELPER( has_result_type, result_type ) - MOCK_IS_FUNCTION_HELPER( has_sig, BOOST_NESTED_TEMPLATE sig< void > ) - MOCK_IS_FUNCTION_HELPER( has_result, BOOST_NESTED_TEMPLATE result< void > ) - -#undef MOCK_IS_FUNCTION_HELPER + BOOST_MPL_HAS_XXX_TRAIT_DEF( result_type ) + BOOST_MPL_HAS_XXX_TEMPLATE_DEF( sig ) + BOOST_MPL_HAS_XXX_TEMPLATE_DEF( result ) template< typename T > struct is_functor