mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Refactoring
git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@318 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
parent
f4127636d5
commit
b9f50e0c4f
2 changed files with 29 additions and 53 deletions
|
|
@ -20,12 +20,11 @@
|
||||||
#include <boost/function_types/function_type.hpp>
|
#include <boost/function_types/function_type.hpp>
|
||||||
#include <boost/function_types/result_type.hpp>
|
#include <boost/function_types/result_type.hpp>
|
||||||
#include <boost/type_traits/is_base_of.hpp>
|
#include <boost/type_traits/is_base_of.hpp>
|
||||||
|
#include <boost/mpl/joint_view.hpp>
|
||||||
|
#include <boost/mpl/single_view.hpp>
|
||||||
|
#include <boost/mpl/pop_front.hpp>
|
||||||
#include <boost/mpl/equal_to.hpp>
|
#include <boost/mpl/equal_to.hpp>
|
||||||
#include <boost/mpl/size_t.hpp>
|
#include <boost/mpl/size_t.hpp>
|
||||||
#include <boost/mpl/vector.hpp>
|
|
||||||
#include <boost/mpl/erase.hpp>
|
|
||||||
#include <boost/mpl/copy.hpp>
|
|
||||||
#include <boost/mpl/back_inserter.hpp>
|
|
||||||
#define BOOST_TYPEOF_SILENT
|
#define BOOST_TYPEOF_SILENT
|
||||||
#include <boost/typeof/typeof.hpp>
|
#include <boost/typeof/typeof.hpp>
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
@ -63,27 +62,20 @@ namespace detail
|
||||||
}
|
}
|
||||||
|
|
||||||
template< typename M >
|
template< typename M >
|
||||||
struct signature
|
struct signature :
|
||||||
{
|
|
||||||
typedef BOOST_DEDUCED_TYPENAME
|
|
||||||
boost::function_types::result_type< M >::type result;
|
|
||||||
typedef BOOST_DEDUCED_TYPENAME
|
|
||||||
boost::function_types::parameter_types< M >::type parameters;
|
|
||||||
typedef BOOST_DEDUCED_TYPENAME
|
|
||||||
boost::function_types::function_type<
|
boost::function_types::function_type<
|
||||||
BOOST_DEDUCED_TYPENAME boost::mpl::push_front<
|
boost::mpl::joint_view<
|
||||||
|
boost::mpl::single_view<
|
||||||
|
BOOST_DEDUCED_TYPENAME
|
||||||
|
boost::function_types::result_type< M >::type
|
||||||
|
>,
|
||||||
BOOST_DEDUCED_TYPENAME boost::mpl::pop_front<
|
BOOST_DEDUCED_TYPENAME boost::mpl::pop_front<
|
||||||
BOOST_DEDUCED_TYPENAME boost::mpl::copy<
|
BOOST_DEDUCED_TYPENAME
|
||||||
parameters,
|
boost::function_types::parameter_types< M >
|
||||||
boost::mpl::back_inserter<
|
>::type
|
||||||
boost::mpl::vector<>
|
|
||||||
>
|
>
|
||||||
>::type
|
>
|
||||||
>::type,
|
{};
|
||||||
result
|
|
||||||
>::type
|
|
||||||
>::type type;
|
|
||||||
};
|
|
||||||
|
|
||||||
template< typename E >
|
template< typename E >
|
||||||
void set_parent( E& e, const std::string& prefix,
|
void set_parent( E& e, const std::string& prefix,
|
||||||
|
|
|
||||||
|
|
@ -16,38 +16,22 @@
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
void f1();
|
struct s
|
||||||
int f2( float );
|
|
||||||
|
|
||||||
BOOST_MPL_ASSERT(( boost::is_same< mock::function< void() >,
|
|
||||||
mock::function< BOOST_TYPEOF( f1 ) > > ));
|
|
||||||
BOOST_MPL_ASSERT(( boost::is_same< mock::function< int( float ) >,
|
|
||||||
mock::function< BOOST_TYPEOF( f2 ) > > ));
|
|
||||||
|
|
||||||
struct example
|
|
||||||
{
|
{
|
||||||
void method1();
|
void m1();
|
||||||
float method2( int );
|
float m2( int );
|
||||||
};
|
};
|
||||||
|
|
||||||
BOOST_STATIC_ASSERT(
|
BOOST_MPL_ASSERT((
|
||||||
(boost::is_same<
|
boost::is_same<
|
||||||
mock::function< void() >,
|
void(),
|
||||||
mock::function<
|
mock::detail::signature< BOOST_TYPEOF( &s::m1 ) >::type
|
||||||
mock::detail::signature<
|
> ));
|
||||||
BOOST_TYPEOF( &example::method1 )
|
BOOST_MPL_ASSERT((
|
||||||
>::type
|
boost::is_same<
|
||||||
>
|
float( int ),
|
||||||
>::value) );
|
mock::detail::signature< BOOST_TYPEOF( &s::m2 ) >::type
|
||||||
BOOST_STATIC_ASSERT(
|
> ));
|
||||||
(boost::is_same<
|
|
||||||
mock::function< float( int ) >,
|
|
||||||
mock::function<
|
|
||||||
mock::detail::signature<
|
|
||||||
BOOST_TYPEOF( &example::method2 )
|
|
||||||
>::type
|
|
||||||
>
|
|
||||||
>::value) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE( ptr_uniformizes_reference_and_pointer )
|
BOOST_AUTO_TEST_CASE( ptr_uniformizes_reference_and_pointer )
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue