diff --git a/include/boost/thread/future.hpp b/include/boost/thread/future.hpp index 6b6745ba..154114ae 100644 --- a/include/boost/thread/future.hpp +++ b/include/boost/thread/future.hpp @@ -4649,32 +4649,34 @@ namespace detail shared_ptr that_; #if ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - BOOST_THREAD_COPYABLE_AND_MOVABLE(run_it) - run_it(run_it const& x) //BOOST_NOEXCEPT - : that_(x.that_) - {} - run_it& operator=(BOOST_THREAD_COPY_ASSIGN_REF(run_it) x) //BOOST_NOEXCEPT - { - if (this != &x) { - that_=x.that_; - } - return *this; + BOOST_THREAD_COPYABLE_AND_MOVABLE(run_it) + run_it(run_it const& x) //BOOST_NOEXCEPT + : that_(x.that_) + {} + run_it& operator=(BOOST_THREAD_COPY_ASSIGN_REF(run_it) x) //BOOST_NOEXCEPT + { + if (this != &x) { + that_=x.that_; } - // move - run_it(BOOST_THREAD_RV_REF(run_it) x) BOOST_NOEXCEPT - : that_(x.that_) - { - x.that_.reset(); - } - run_it& operator=(BOOST_THREAD_RV_REF(run_it) x) BOOST_NOEXCEPT { - if (this != &x) { - that_=x.that_; - x.that_.reset(); - } - return *this; + return *this; + } + // move + run_it(BOOST_THREAD_RV_REF(run_it) x) BOOST_NOEXCEPT + : that_(boost::move(x.that_)) + { + } + run_it& operator=(BOOST_THREAD_RV_REF(run_it) x) BOOST_NOEXCEPT { + if (this != &x) { + that_ = boost::move(x.that_); } + return *this; + } + run_it(shared_ptr that) : that_(boost::move(that)) + {} +#else + run_it(shared_ptr that) : that_(that) + {} #endif - run_it(shared_ptr that) : that_ (that) {} void operator()() {