Refactoring

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@123 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2010-02-16 17:11:11 +00:00
parent 058397d415
commit 8a2030ce5f
3 changed files with 12 additions and 14 deletions

View file

@ -21,14 +21,12 @@ namespace detail
typedef boost::type_traits::yes_type yes_type;
typedef boost::type_traits::no_type no_type;
#define MOCK_IS_FUNCTION_HELPER(name, check) \
template< typename T > yes_type& name##_helper( T*, BOOST_DEDUCED_TYPENAME T::check* = 0 ); \
template< typename T > no_type& name##_helper( T, ... ); \
template< typename T > struct name \
{ \
static T* t; \
enum { value = sizeof( name##_helper( t ) ) == sizeof( yes_type ) }; \
};
#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 > )
@ -40,10 +38,10 @@ namespace detail
struct is_functor
{
typedef BOOST_DEDUCED_TYPENAME boost::mpl::or_<
BOOST_DEDUCED_TYPENAME boost::function_types::is_callable_builtin< T >::type,
BOOST_DEDUCED_TYPENAME boost::integral_constant< bool, has_result_type< T >::value >::type,
BOOST_DEDUCED_TYPENAME boost::integral_constant< bool, has_result< T >::value >::type,
BOOST_DEDUCED_TYPENAME boost::integral_constant< bool, has_sig< T >::value >::type
boost::function_types::is_callable_builtin< T >,
has_result_type< T >,
has_result< T >,
has_sig< T >
>::type type;
};
}

View file

@ -169,7 +169,7 @@ namespace detail
typedef BOOST_DEDUCED_TYPENAME \
boost::mpl::at_c< \
BOOST_DEDUCED_TYPENAME \
boost::function_types::parameter_types< Signature >::type, \
boost::function_types::parameter_types< Signature >, \
n \
>::type arg##n##_type; \
typedef detail::check< arg##n##_type > constraint##n##_type;

View file

@ -164,7 +164,7 @@ namespace detail
typedef BOOST_DEDUCED_TYPENAME
boost::mpl::at_c<
BOOST_DEDUCED_TYPENAME
boost::function_types::parameter_types< S >::type,
boost::function_types::parameter_types< S >,
n - 1
>::type type;
};