From 9faab7749cd019f4f9a728c9195f1ac5b27d61b9 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Thu, 9 Jul 2020 18:51:40 +0200 Subject: [PATCH] Assume existance of --- doc/example/patterns_invoke_functor.cpp | 4 ++-- include/turtle/config.hpp | 6 ------ include/turtle/detail/action.hpp | 7 +------ test/detail/test_function.cpp | 8 ++++---- test/detail/test_is_functor.cpp | 6 ++++++ test/test_integration.cpp | 5 +++-- 6 files changed, 16 insertions(+), 20 deletions(-) diff --git a/doc/example/patterns_invoke_functor.cpp b/doc/example/patterns_invoke_functor.cpp index f4d281d..d0c9f81 100644 --- a/doc/example/patterns_invoke_functor.cpp +++ b/doc/example/patterns_invoke_functor.cpp @@ -7,14 +7,14 @@ // http://www.boost.org/LICENSE_1_0.txt) //[ invoke_functor_problem -#include +#include namespace { class base_class { public: - virtual void method( const boost::function< void( int ) >& functor ) = 0; + virtual void method( const std::function< void( int ) >& functor ) = 0; }; void function( base_class& ); // the function will call 'method' with a functor to be applied diff --git a/include/turtle/config.hpp b/include/turtle/config.hpp index bc8d096..dfce9fa 100644 --- a/include/turtle/config.hpp +++ b/include/turtle/config.hpp @@ -40,12 +40,6 @@ # error BOOST_FT_MAX_ARITY must be set to MOCK_MAX_ARGS + 1 or higher #endif -#if !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) -# ifndef MOCK_NO_HDR_FUNCTIONAL -# define MOCK_HDR_FUNCTIONAL -# endif -#endif - #if !defined(BOOST_NO_CXX11_HDR_MUTEX) && !defined(BOOST_NO_0X_HDR_MUTEX) # ifndef MOCK_NO_HDR_MUTEX # define MOCK_HDR_MUTEX diff --git a/include/turtle/detail/action.hpp b/include/turtle/detail/action.hpp index 8cdfe72..74bf0b2 100644 --- a/include/turtle/detail/action.hpp +++ b/include/turtle/detail/action.hpp @@ -12,9 +12,9 @@ #include "../config.hpp" #include #include -#include #include #include +#include #include namespace mock @@ -25,13 +25,8 @@ namespace detail class action_base { private: -#ifdef MOCK_HDR_FUNCTIONAL typedef std::function< Signature > functor_type; typedef std::function< Result() > action_type; -#else - typedef boost::function< Signature > functor_type; - typedef boost::function< Result() > action_type; -#endif public: const functor_type& functor() const diff --git a/test/detail/test_function.cpp b/test/detail/test_function.cpp index 1a322d7..661482f 100644 --- a/test/detail/test_function.cpp +++ b/test/detail/test_function.cpp @@ -13,15 +13,15 @@ #include #include #include -#include #include +#include #include // static namespace { - boost::function< void() > static_f; + std::function< void() > static_f; static_assert( std::is_same< void, boost::result_of< mock::detail::function< void() >() >::type >::value, "!"); static_assert( std::is_same< int, boost::result_of< mock::detail::function< int() >() >::type >::value, "!"); @@ -34,13 +34,13 @@ namespace BOOST_FIXTURE_TEST_CASE( a_function_can_be_passed_as_functor, mock_error_fixture ) { mock::detail::function< void() > f; - boost::function< void() > functor = f; + std::function< void() > functor = f; } BOOST_FIXTURE_TEST_CASE( a_function_can_be_passed_as_functor_using_boost_bind_and_boost_ref, mock_error_fixture ) { mock::detail::function< void() > f; - boost::function< void() > functor = boost::bind( boost::ref( f ) ); + std::function< void() > functor = boost::bind( boost::ref( f ) ); } // invocations diff --git a/test/detail/test_is_functor.cpp b/test/detail/test_is_functor.cpp index 6a659c6..c0f1c22 100644 --- a/test/detail/test_is_functor.cpp +++ b/test/detail/test_is_functor.cpp @@ -18,6 +18,7 @@ #endif #include #include +#include namespace { @@ -93,6 +94,11 @@ BOOST_AUTO_TEST_CASE( boost_function_is_functor ) is_functor( boost::function< void(int) >() ); } +BOOST_AUTO_TEST_CASE( std_function_is_functor ) +{ + is_functor( std::function< void(int) >() ); +} + #ifdef MOCK_LAMBDAS BOOST_AUTO_TEST_CASE( cxx11_lambda_is_functor ) diff --git a/test/test_integration.cpp b/test/test_integration.cpp index 587984e..15e4a30 100644 --- a/test/test_integration.cpp +++ b/test/test_integration.cpp @@ -14,6 +14,7 @@ #include #include #include +#include namespace { @@ -153,7 +154,7 @@ namespace BOOST_FIXTURE_TEST_CASE( mock_functor_in_namespace_is_supported, mock_error_fixture ) { - boost::function< int( float, const std::string& ) > func; + std::function< int( float, const std::string& ) > func; MOCK_EXPECT( gf ).once().with( 3, "op" ).returns( 42 ); func = gf; BOOST_CHECK_EQUAL( 42, func( 3, "op" ) ); @@ -162,7 +163,7 @@ BOOST_FIXTURE_TEST_CASE( mock_functor_in_namespace_is_supported, mock_error_fixt BOOST_FIXTURE_TEST_CASE( mock_functor_in_function_is_supported, mock_error_fixture ) { - boost::function< int( float, const std::string& ) > func; + std::function< int( float, const std::string& ) > func; { MOCK_FUNCTOR( f, int( float, const std::string& ) ); MOCK_EXPECT( f ).once().with( 3, "op" ).returns( 42 );