From 476c1a7831812e31cb8c96644404644f655232d4 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Tue, 14 Jul 2020 21:23:30 +0200 Subject: [PATCH] Remove some superflous typedefs and default impls --- include/turtle/detail/function_impl_template.hpp | 12 ++---------- include/turtle/detail/function_template.hpp | 9 --------- include/turtle/detail/mutex.hpp | 14 ++------------ include/turtle/detail/sequence_impl.hpp | 4 +--- 4 files changed, 5 insertions(+), 34 deletions(-) diff --git a/include/turtle/detail/function_impl_template.hpp b/include/turtle/detail/function_impl_template.hpp index c5a212d..c40d66d 100644 --- a/include/turtle/detail/function_impl_template.hpp +++ b/include/turtle/detail/function_impl_template.hpp @@ -112,17 +112,9 @@ namespace detail , lock_( m ) {} wrapper(const wrapper&) = delete; - wrapper( wrapper&& x ) - : base_type( x ) - , lock_( std::move( x.lock_) ) - {} + wrapper( wrapper&& x ) = default; wrapper& operator=(const wrapper&) = delete; - wrapper& operator=( wrapper&& x ) - { - static_cast< base_type& >( *this ) = x; - lock_ = std::move( x.lock_ ); - return *this; - } + wrapper& operator=( wrapper&& x ) = default; wrapper& once() { this->e_->invoke( std::make_unique< detail::once >() ); diff --git a/include/turtle/detail/function_template.hpp b/include/turtle/detail/function_template.hpp index 10183ec..179148e 100644 --- a/include/turtle/detail/function_template.hpp +++ b/include/turtle/detail/function_template.hpp @@ -21,15 +21,6 @@ namespace detail BOOST_PP_ENUM_TRAILING_PARAMS(MOCK_NUM_ARGS, typename T) > class function< R ( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) ) > { - public: - typedef R result_type; - - template< typename Args > - struct sig - { - typedef R type; - }; - private: typedef function_impl< R ( BOOST_PP_ENUM_PARAMS(MOCK_NUM_ARGS, T) ) diff --git a/include/turtle/detail/mutex.hpp b/include/turtle/detail/mutex.hpp index 5cc193b..793a666 100644 --- a/include/turtle/detail/mutex.hpp +++ b/include/turtle/detail/mutex.hpp @@ -48,19 +48,9 @@ namespace detail m_->unlock(); } lock( const lock& ) = delete; - lock( lock&& x ) - : m_( x.m_ ) - { - // Explicit reset to avoid unlock in destructor - x.m_.reset(); - } + lock( lock&& x ) = default; lock& operator=( const lock& ) = delete; - lock& operator=( lock&& x ) - { - m_ = x.m_; - x.m_.reset(); - return *this; - } + lock& operator=( lock&& x ) = default; private: std::shared_ptr< mutex > m_; diff --git a/include/turtle/detail/sequence_impl.hpp b/include/turtle/detail/sequence_impl.hpp index d3f9f90..f53fff9 100644 --- a/include/turtle/detail/sequence_impl.hpp +++ b/include/turtle/detail/sequence_impl.hpp @@ -54,9 +54,7 @@ namespace detail } private: - typedef std::vector< void* > elements_type; - - elements_type elements_; + std::vector< void* > elements_; const std::shared_ptr< mutex > mutex_; }; }