mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@478 860be788-9bd5-4423-9f1e-828f051e677b
49 lines
1.4 KiB
C++
49 lines
1.4 KiB
C++
// http://turtle.sourceforge.net
|
|
//
|
|
// Copyright Mathieu Champlon 2009
|
|
//
|
|
// Distributed under the Boost Software License, Version 1.0.
|
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
|
// http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
#ifndef MOCK_IS_FUNCTOR_HPP_INCLUDED
|
|
#define MOCK_IS_FUNCTOR_HPP_INCLUDED
|
|
|
|
#include "detail/yes_no_type.hpp"
|
|
#include <boost/function_types/is_callable_builtin.hpp>
|
|
#include <boost/mpl/bool.hpp>
|
|
#include <boost/mpl/or.hpp>
|
|
|
|
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
|
|
|
|
template< typename T >
|
|
struct is_functor
|
|
: boost::mpl::or_<
|
|
boost::function_types::is_callable_builtin< T >,
|
|
has_result_type< T >,
|
|
has_result< T >,
|
|
has_sig< T >
|
|
>
|
|
{};
|
|
}
|
|
} // mock
|
|
|
|
#endif // MOCK_IS_FUNCTOR_HPP_INCLUDED
|