diff --git a/include/boost/fiber/detail/fiber_base.hpp b/include/boost/fiber/detail/fiber_base.hpp index 43d8574a..278e02ea 100644 --- a/include/boost/fiber/detail/fiber_base.hpp +++ b/include/boost/fiber/detail/fiber_base.hpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -72,23 +73,23 @@ private: std::atomic< std::size_t > use_count_; context::execution_context ctx_; fss_data_t fss_data_; - std::chrono::high_resolution_clock::time_point tp_; std::atomic< fiber_status > state_; std::atomic< int > flags_; spinlock splk_; std::vector< fiber_handle > waiting_; std::exception_ptr except_; + std::chrono::high_resolution_clock::time_point tp_; // main-context fiber fiber_base() : use_count_( 1), ctx_( context::execution_context::current() ), fss_data_(), - tp_( (std::chrono::high_resolution_clock::time_point::max)() ), state_( fiber_status::running), flags_( flag_main_fiber | flag_thread_affinity), waiting_(), except_(), + tp_( (std::chrono::high_resolution_clock::time_point::max)() ), nxt() { } @@ -121,11 +122,11 @@ private: BOOST_ASSERT_MSG( false, "fiber already terminated"); }), fss_data_(), - tp_( (std::chrono::high_resolution_clock::time_point::max)() ), state_( fiber_status::ready), flags_( 0), waiting_(), except_(), + tp_( (std::chrono::high_resolution_clock::time_point::max)() ), nxt( nullptr) { } @@ -194,7 +195,7 @@ public: // generalized lambda captures are support by C++14 template< typename StackAlloc, typename Fn > explicit fiber_base( StackAlloc salloc, Fn && fn) : - fiber_base( salloc, make_rref( std::move( fn) ) ) { + fiber_base( salloc, make_rref( std::forward< Fn >( fn) ) ) { } virtual ~fiber_base() { diff --git a/include/boost/fiber/detail/rref.hpp b/include/boost/fiber/detail/rref.hpp index 7e8f2fab..223dbf95 100644 --- a/include/boost/fiber/detail/rref.hpp +++ b/include/boost/fiber/detail/rref.hpp @@ -27,15 +27,15 @@ template< typename Fn > class rref { public: rref( Fn && fn) : - fn_( std::move( fn) ) { + fn_( std::forward< Fn >( fn) ) { } rref( rref & other) : - fn_( std::move( other.fn_) ) { + fn_( std::forward< Fn >( other.fn_) ) { } rref( rref && other) : - fn_( std::move( other.fn_) ) { + fn_( std::forward< Fn >( other.fn_) ) { } rref( rref const& other) = delete; @@ -49,9 +49,9 @@ private: Fn fn_; }; -template< typename T > -rref< T > make_rref( T && t) { - return rref< T >( std::move( t) ); +template< typename Fn > +rref< Fn > make_rref( Fn && fn) { + return rref< Fn >( std::forward< Fn >( fn) ); } }}}