From da031fcfda3dd88d90fb7679548d81e449936867 Mon Sep 17 00:00:00 2001 From: Oliver Kowalke Date: Sun, 9 Feb 2014 09:03:47 +0100 Subject: [PATCH] remove passing rvalues --- .../detail/symmetric_coroutine_call.hpp | 10 +---- .../detail/symmetric_coroutine_impl.hpp | 44 ++++++------------- .../detail/symmetric_coroutine_yield.hpp | 6 +-- 3 files changed, 17 insertions(+), 43 deletions(-) diff --git a/include/boost/coroutine/detail/symmetric_coroutine_call.hpp b/include/boost/coroutine/detail/symmetric_coroutine_call.hpp index 8963a62..ee649d0 100644 --- a/include/boost/coroutine/detail/symmetric_coroutine_call.hpp +++ b/include/boost/coroutine/detail/symmetric_coroutine_call.hpp @@ -303,21 +303,13 @@ public: std::swap( callee_, other.callee_); } - symmetric_coroutine_call & operator()( Arg const& arg) BOOST_NOEXCEPT + symmetric_coroutine_call & operator()( Arg arg) BOOST_NOEXCEPT { BOOST_ASSERT( * this); impl_->run( arg); return * this; } - - symmetric_coroutine_call & operator()( BOOST_RV_REF( Arg) arg) BOOST_NOEXCEPT - { - BOOST_ASSERT( * this); - - impl_->run( forward< Arg >( arg) ); - return * this; - } }; template< typename Arg, typename StackAllocator > diff --git a/include/boost/coroutine/detail/symmetric_coroutine_impl.hpp b/include/boost/coroutine/detail/symmetric_coroutine_impl.hpp index 916a48b..21a3ac2 100644 --- a/include/boost/coroutine/detail/symmetric_coroutine_impl.hpp +++ b/include/boost/coroutine/detail/symmetric_coroutine_impl.hpp @@ -112,15 +112,7 @@ public: } } - void run( R const& r) BOOST_NOEXCEPT - { - BOOST_ASSERT( ! is_complete() ); - - param_type to( const_cast< R * >( & r) ); - run_( & to); - } - - void run( BOOST_RV_REF( R) r) BOOST_NOEXCEPT + void run( R r) BOOST_NOEXCEPT { BOOST_ASSERT( ! is_complete() ); @@ -145,22 +137,22 @@ public: } template< typename X > - R * yield_to( symmetric_coroutine_impl< X > * other, X const& x) + R * yield_to( symmetric_coroutine_impl< X > * other, X x) { BOOST_ASSERT( ! is_complete() ); BOOST_ASSERT( ! other->is_complete() ); - typename symmetric_coroutine_impl< X >::param_type to( const_cast< X * >( & x) ); + typename symmetric_coroutine_impl< X >::param_type to( & x); return yield_to_( other, & to); } template< typename X > - R * yield_to( symmetric_coroutine_impl< X & > * other, X const& x) + R * yield_to( symmetric_coroutine_impl< X & > * other, X & x) { BOOST_ASSERT( ! is_complete() ); BOOST_ASSERT( ! other->is_complete() ); - typename symmetric_coroutine_impl< X & >::param_type to( const_cast< X * >( & x) ); + typename symmetric_coroutine_impl< X & >::param_type to( & x); return yield_to_( other, & to); } @@ -281,22 +273,22 @@ public: } template< typename X > - R * yield_to( symmetric_coroutine_impl< X > * other, X const& x) + R * yield_to( symmetric_coroutine_impl< X > * other, X x) { BOOST_ASSERT( ! is_complete() ); BOOST_ASSERT( ! other->is_complete() ); - typename symmetric_coroutine_impl< X >::param_type to( const_cast< X * >( & x) ); + typename symmetric_coroutine_impl< X >::param_type to( & x); return yield_to_( other, & to); } template< typename X > - R * yield_to( symmetric_coroutine_impl< X & > * other, X const& x) + R * yield_to( symmetric_coroutine_impl< X & > * other, X & x) { BOOST_ASSERT( ! is_complete() ); BOOST_ASSERT( ! other->is_complete() ); - typename symmetric_coroutine_impl< X & >::param_type to( const_cast< X * >( & x) ); + typename symmetric_coroutine_impl< X & >::param_type to( & x); return yield_to_( other, & to); } @@ -393,16 +385,6 @@ public: preserve_fpu() ); } - template< typename X > - void yield_to( symmetric_coroutine_impl< X > * other, X x) - { - BOOST_ASSERT( ! is_complete() ); - BOOST_ASSERT( ! other->is_complete() ); - - typename symmetric_coroutine_impl< X >::param_type to( & x); - yield_to_( other, & to); - } - void yield() BOOST_NOEXCEPT { BOOST_ASSERT( ! is_complete() ); @@ -418,22 +400,22 @@ public: } template< typename X > - void yield_to( symmetric_coroutine_impl< X > * other, X const& x) + void yield_to( symmetric_coroutine_impl< X > * other, X x) { BOOST_ASSERT( ! is_complete() ); BOOST_ASSERT( ! other->is_complete() ); - typename symmetric_coroutine_impl< X >::param_type to( const_cast< X * >( & x) ); + typename symmetric_coroutine_impl< X >::param_type to( & x); yield_to_( other, & to); } template< typename X > - void yield_to( symmetric_coroutine_impl< X & > * other, X const& x) + void yield_to( symmetric_coroutine_impl< X & > * other, X & x) { BOOST_ASSERT( ! is_complete() ); BOOST_ASSERT( ! other->is_complete() ); - typename symmetric_coroutine_impl< X & >::param_type to( const_cast< X * >( & x) ); + typename symmetric_coroutine_impl< X & >::param_type to( & x); yield_to_( other, & to); } diff --git a/include/boost/coroutine/detail/symmetric_coroutine_yield.hpp b/include/boost/coroutine/detail/symmetric_coroutine_yield.hpp index 3079621..bcd6f3a 100644 --- a/include/boost/coroutine/detail/symmetric_coroutine_yield.hpp +++ b/include/boost/coroutine/detail/symmetric_coroutine_yield.hpp @@ -90,7 +90,7 @@ public: } template< typename Coro > - symmetric_coroutine_yield & operator()( Coro & other, typename Coro::value_type const& x, + symmetric_coroutine_yield & operator()( Coro & other, typename Coro::value_type & x, typename disable_if< is_same< typename Coro::value_type, void >, dummy* @@ -183,7 +183,7 @@ public: } template< typename Coro > - symmetric_coroutine_yield & operator()( Coro & other, typename Coro::value_type const& x, + symmetric_coroutine_yield & operator()( Coro & other, typename Coro::value_type & x, typename disable_if< is_same< typename Coro::value_type, void >, dummy* @@ -267,7 +267,7 @@ public: } template< typename Coro > - symmetric_coroutine_yield & operator()( Coro & other, typename Coro::value_type const& x, + symmetric_coroutine_yield & operator()( Coro & other, typename Coro::value_type & x, typename disable_if< is_same< typename Coro::value_type, void >, dummy*