mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Use boost move to implement movable only wrapper class
This commit is contained in:
parent
04497bd5b5
commit
7024b37789
1 changed files with 7 additions and 3 deletions
|
|
@ -7,6 +7,7 @@
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
#include "expectation_template.hpp"
|
#include "expectation_template.hpp"
|
||||||
|
#include <boost/move/utility.hpp>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
|
||||||
#ifndef MOCK_ERROR_POLICY
|
#ifndef MOCK_ERROR_POLICY
|
||||||
|
|
@ -108,14 +109,17 @@ namespace detail
|
||||||
|
|
||||||
struct wrapper : wrapper_base< R, expectation_type >
|
struct wrapper : wrapper_base< R, expectation_type >
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
BOOST_MOVABLE_BUT_NOT_COPYABLE(wrapper);
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
wrapper( const boost::shared_ptr< mutex >& m, expectation_type& e )
|
wrapper( const boost::shared_ptr< mutex >& m, expectation_type& e )
|
||||||
: wrapper_base< R, expectation_type >( e )
|
: wrapper_base< R, expectation_type >( e )
|
||||||
, lock_( m )
|
, lock_( m )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
wrapper(const wrapper &) = delete;
|
wrapper( BOOST_RV_REF(wrapper) w)
|
||||||
|
|
||||||
wrapper( wrapper && w)
|
|
||||||
: wrapper_base< R, expectation_type > (*w.e_)
|
: wrapper_base< R, expectation_type > (*w.e_)
|
||||||
, lock_( std::move(w.lock_) )
|
, lock_( std::move(w.lock_) )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue