diff --git a/doc/asymmetric.qbk b/doc/asymmetric.qbk index 76bf4a7..990ccb8 100644 --- a/doc/asymmetric.qbk +++ b/doc/asymmetric.qbk @@ -390,13 +390,11 @@ resumed with __push_coro_op__, __pull_coro_op__).] class coroutine<>::pull_type { public: - pull_type() noexcept; - template< typename Fn > - pull_type( Fn && fn, attributes const& attr = attributes() ); + pull_type( Fn && fn); - template< typename Fn, typename StackAllocator > - pull_type( Fn && fn, attributes const& attr, StackAllocator stack_alloc); + template< typename StackAllocator, typename Fn > + pull_type( StackAllocator stack_alloc, Fn && fn); pull_type( pull_type const& other)=delete; @@ -408,50 +406,32 @@ resumed with __push_coro_op__, __pull_coro_op__).] pull_type & operator=( pull_type && other) noexcept; - operator unspecified-bool-type() const noexcept; + pull_coroutine & operator()(); + + explicit operator bool() const noexcept; bool operator!() const noexcept; - void swap( pull_type & other) noexcept; - - pull_type & operator()(); - - R get() const; + R get() noexcept; }; - template< typename R > - void swap( pull_type< R > & l, pull_type< R > & r); - template< typename R > range_iterator< pull_type< R > >::type begin( pull_type< R > &); template< typename R > range_iterator< pull_type< R > >::type end( pull_type< R > &); -[heading `pull_type()`] -[variablelist -[[Effects:] [Creates a coroutine representing __not_a_coro__.]] -[[Throws:] [Nothing.]] -] - [heading `template< typename Fn > - pull_type( Fn && fn, attributes const& attr)`] + pull_type( Fn && fn)`] [variablelist -[[Preconditions:] [`size` >= minimum_stacksize(), `size` <= maximum_stacksize() -when ! is_stack_unbounded().]] -[[Effects:] [Creates a coroutine which will execute `fn`, and enters it. -Argument `attr` determines stack clean-up and preserving floating-point -registers.]] +[[Effects:] [Creates a coroutine which will execute `fn`, and enters it.]] [[Throws:] [Exceptions thrown inside __coro_fn__.]] ] -[heading `template< typename Fn, typename StackAllocator > - pull_type( Fn && fn, attributes const& attr, StackAllocator const& stack_alloc)`] +[heading `template< typename StackAllocator, typename Fn > + pull_type( StackAllocator const& stack_alloc, Fn && fn)`] [variablelist -[[Preconditions:] [`size` >= minimum_stacksize(), `size` <= maximum_stacksize() -when ! is_stack_unbounded().]] -[[Effects:] [Creates a coroutine which will execute `fn`. Argument `attr` -determines stack clean-up and preserving floating-point registers. +[[Effects:] [Creates a coroutine which will execute `fn`. For allocating/deallocating the stack `stack_alloc` is used.]] [[Throws:] [Exceptions thrown inside __coro_fn__.]] ] @@ -475,14 +455,14 @@ internal data of `other` to `*this`. `other` becomes __not_a_coro__.]] [[Throws:] [Nothing.]] ] -[heading `operator unspecified-bool-type() const`] +[heading `explicit operator bool() const noexcept`] [variablelist [[Returns:] [If `*this` refers to __not_a_coro__ or the coroutine-function has returned (completed), the function returns `false`. Otherwise `true`.]] [[Throws:] [Nothing.]] ] -[heading `bool operator!() const`] +[heading `bool operator!() const noexcept`] [variablelist [[Returns:] [If `*this` refers to __not_a_coro__ or the coroutine-function has returned (completed), the function returns `true`. Otherwise `false`.]] @@ -497,7 +477,7 @@ passed to the coroutine-function).]] [[Throws:] [Exceptions thrown inside __coro_fn__.]] ] -[heading `R get()`] +[heading `R get() noexcept`] R coroutine::pull_type::get(); R& coroutine::pull_type::get(); @@ -512,22 +492,6 @@ __push_coro_op__.]] the next __pull_coro_op__ call.]] ] -[heading `void swap( pull_type & other)`] -[variablelist -[[Effects:] [Swaps the internal data from `*this` with the values -of `other`.]] -[[Throws:] [Nothing.]] -] - -[heading Non-member function `swap()`] - - template< typename R > - void swap( pull_type< R > & l, pull_type< R > & r); - -[variablelist -[[Effects:] [As if 'l.swap( r)'.]] -] - [heading Non-member function `begin( pull_type< R > &)`] template< typename R > range_iterator< pull_type< R > >::type begin( pull_type< R > &); @@ -559,13 +523,11 @@ would return `false`.]] class coroutine<>::push_type { public: - push_type() noexcept; - template< typename Fn > - push_type( Fn && fn, attributes const& attr = attributes() ); + push_type( Fn && fn); - template< typename Fn, typename StackAllocator > - push_type( Fn && fn, attributes const& attr, StackAllocator stack_alloc); + template< typename StackAllocator, typename Fn > + push_type( StackAllocator stack_alloc, Fn && fn); push_type( push_type const& other)=delete; @@ -577,46 +539,29 @@ would return `false`.]] push_type & operator=( push_type && other) noexcept; - operator unspecified-bool-type() const noexcept; + explicit operator bool() const noexcept; bool operator!() const noexcept; - void swap( push_type & other) noexcept; - push_type & operator()( Arg arg); }; - template< typename Arg > - void swap( push_type< Arg > & l, push_type< Arg > & r); - template< typename Arg > range_iterator< push_type< Arg > >::type begin( push_type< Arg > &); template< typename Arg > range_iterator< push_type< Arg > >::type end( push_type< Arg > &); -[heading `push_type()`] -[variablelist -[[Effects:] [Creates a coroutine representing __not_a_coro__.]] -[[Throws:] [Nothing.]] -] - [heading `template< typename Fn > - push_type( Fn && fn, attributes const& attr)`] + push_type( Fn && fn)`] [variablelist -[[Preconditions:] [`size` >= minimum_stacksize(), `size` <= maximum_stacksize() -when ! is_stack_unbounded().]] -[[Effects:] [Creates a coroutine which will execute `fn`. Argument `attr` -determines stack clean-up and preserving floating-point registers.]] +[[Effects:] [Creates a coroutine which will execute `fn`.]] ] -[heading `template< typename Fn, typename StackAllocator > - push_type( Fn && fn, attributes const& attr, StackAllocator const& stack_alloc)`] +[heading `template< typename StackAllocator, typename Fn > + push_type( StackAllocator const& stack_alloc, Fn && fn)`] [variablelist -[[Preconditions:] [`size` >= minimum_stacksize(), `size` <= maximum_stacksize() -when ! is_stack_unbounded().]] -[[Effects:] [Creates a coroutine which will execute `fn`. Argument `attr` -determines stack clean-up and preserving floating-point registers. +[[Effects:] [Creates a coroutine which will execute `fn`. For allocating/deallocating the stack `stack_alloc` is used.]] ] @@ -625,28 +570,28 @@ For allocating/deallocating the stack `stack_alloc` is used.]] [[Effects:] [Destroys the context and deallocates the stack.]] ] -[heading `push_type( push_type && other)`] +[heading `push_type( push_type && other) noexcept`] [variablelist [[Effects:] [Moves the internal data of `other` to `*this`. `other` becomes __not_a_coro__.]] [[Throws:] [Nothing.]] ] -[heading `push_type & operator=( push_type && other)`] +[heading `push_type & operator=( push_type && other) noexcept`] [variablelist [[Effects:] [Destroys the internal data of `*this` and moves the internal data of `other` to `*this`. `other` becomes __not_a_coro__.]] [[Throws:] [Nothing.]] ] -[heading `operator unspecified-bool-type() const`] +[heading `explicit operator bool() const noexcept`] [variablelist [[Returns:] [If `*this` refers to __not_a_coro__ or the coroutine-function has returned (completed), the function returns `false`. Otherwise `true`.]] [[Throws:] [Nothing.]] ] -[heading `bool operator!() const`] +[heading `bool operator!() const noexcept`] [variablelist [[Returns:] [If `*this` refers to __not_a_coro__ or the coroutine-function has returned (completed), the function returns `true`. Otherwise `false`.]] @@ -666,22 +611,6 @@ has returned (completed), the function returns `true`. Otherwise `false`.]] [[Throws:] [Exceptions thrown inside __coro_fn__.]] ] -[heading `void swap( push_type & other)`] -[variablelist -[[Effects:] [Swaps the internal data from `*this` with the values -of `other`.]] -[[Throws:] [Nothing.]] -] - -[heading Non-member function `swap()`] - - template< typename Arg > - void swap( push_type< Arg > & l, push_type< Arg > & r); - -[variablelist -[[Effects:] [As if 'l.swap( r)'.]] -] - [heading Non-member function `begin( push_type< Arg > &)`] template< typename Arg > range_iterator< push_type< Arg > >::type begin( push_type< Arg > &); diff --git a/include/boost/coroutine2/detail/pull_control_block_ecv2.ipp b/include/boost/coroutine2/detail/pull_control_block_ecv2.ipp index 766a3f5..a1c7c93 100644 --- a/include/boost/coroutine2/detail/pull_control_block_ecv2.ipp +++ b/include/boost/coroutine2/detail/pull_control_block_ecv2.ipp @@ -49,7 +49,7 @@ pull_coroutine< T >::control_block::control_block( context::preallocated palloc, ctx{ std::allocator_arg, palloc, salloc, std::move( std::bind( - [this]( typename std::decay< Fn >::type & fn_, boost::context::execution_context< T * > ctx, T *) mutable { + [this]( typename std::decay< Fn >::type & fn_, boost::context::execution_context< T * > && ctx, T *) mutable { // create synthesized push_coroutine< T > typename push_coroutine< T >::control_block synthesized_cb{ this, ctx }; push_coroutine< T > synthesized{ & synthesized_cb }; @@ -78,7 +78,7 @@ pull_coroutine< T >::control_block::control_block( context::preallocated palloc, std::placeholders::_2))}, #else ctx{ std::allocator_arg, palloc, salloc, - [this,fn_=std::forward< Fn >( fn)]( boost::context::execution_context< T * > ctx, T *) mutable { + [this,fn_=std::forward< Fn >( fn)]( boost::context::execution_context< T * > && ctx, T *) mutable { // create synthesized push_coroutine< T > typename push_coroutine< T >::control_block synthesized_cb{ this, ctx }; push_coroutine< T > synthesized{ & synthesized_cb }; @@ -199,7 +199,7 @@ pull_coroutine< T & >::control_block::control_block( context::preallocated pallo ctx{ std::allocator_arg, palloc, salloc, std::move( std::bind( - [this]( typename std::decay< Fn >::type & fn_, boost::context::execution_context< T *> ctx, T *) mutable { + [this]( typename std::decay< Fn >::type & fn_, boost::context::execution_context< T *> && ctx, T *) mutable { // create synthesized push_coroutine< T & > typename push_coroutine< T & >::control_block synthesized_cb{ this, ctx }; push_coroutine< T & > synthesized{ & synthesized_cb }; @@ -228,7 +228,7 @@ pull_coroutine< T & >::control_block::control_block( context::preallocated pallo std::placeholders::_2))}, #else ctx{ std::allocator_arg, palloc, salloc, - [this,fn_=std::forward< Fn >( fn)]( boost::context::execution_context< T * > ctx, T *) mutable { + [this,fn_=std::forward< Fn >( fn)]( boost::context::execution_context< T * > && ctx, T *) mutable { // create synthesized push_coroutine< T & > typename push_coroutine< T & >::control_block synthesized_cb{ this, ctx }; push_coroutine< T & > synthesized{ & synthesized_cb }; @@ -323,7 +323,7 @@ pull_coroutine< void >::control_block::control_block( context::preallocated pall ctx{ std::allocator_arg, palloc, salloc, std::move( std::bind( - [this]( typename std::decay< Fn >::type & fn_, boost::context::execution_context< void > ctx) mutable { + [this]( typename std::decay< Fn >::type & fn_, boost::context::execution_context< void > && ctx) mutable { // create synthesized push_coroutine< void > typename push_coroutine< void >::control_block synthesized_cb{ this, ctx }; push_coroutine< void > synthesized{ & synthesized_cb }; @@ -350,7 +350,7 @@ pull_coroutine< void >::control_block::control_block( context::preallocated pall std::placeholders::_1))}, #else ctx{ std::allocator_arg, palloc, salloc, - [this,fn_=std::forward< Fn >( fn)]( boost::context::execution_context< void > ctx) mutable { + [this,fn_=std::forward< Fn >( fn)]( boost::context::execution_context< void > && ctx) mutable { // create synthesized push_coroutine< void > typename push_coroutine< void >::control_block synthesized_cb{ this, ctx }; push_coroutine< void > synthesized{ & synthesized_cb }; diff --git a/include/boost/coroutine2/detail/pull_coroutine.hpp b/include/boost/coroutine2/detail/pull_coroutine.hpp index 7123eac..b97bdc3 100644 --- a/include/boost/coroutine2/detail/pull_coroutine.hpp +++ b/include/boost/coroutine2/detail/pull_coroutine.hpp @@ -47,7 +47,7 @@ public: template< typename StackAllocator, typename Fn > pull_coroutine( StackAllocator, Fn &&); - ~pull_coroutine() noexcept; + ~pull_coroutine(); pull_coroutine( pull_coroutine const&) = delete; pull_coroutine & operator=( pull_coroutine const&) = delete; @@ -159,7 +159,7 @@ public: template< typename StackAllocator, typename Fn > pull_coroutine( StackAllocator, Fn &&); - ~pull_coroutine() noexcept; + ~pull_coroutine(); pull_coroutine( pull_coroutine const&) = delete; pull_coroutine & operator=( pull_coroutine const&) = delete; @@ -269,7 +269,7 @@ public: template< typename StackAllocator, typename Fn > pull_coroutine( StackAllocator, Fn &&); - ~pull_coroutine() noexcept; + ~pull_coroutine(); pull_coroutine( pull_coroutine const&) = delete; pull_coroutine & operator=( pull_coroutine const&) = delete; diff --git a/include/boost/coroutine2/detail/pull_coroutine.ipp b/include/boost/coroutine2/detail/pull_coroutine.ipp index 58fe845..9a81893 100644 --- a/include/boost/coroutine2/detail/pull_coroutine.ipp +++ b/include/boost/coroutine2/detail/pull_coroutine.ipp @@ -59,7 +59,7 @@ pull_coroutine< T >::pull_coroutine( StackAllocator salloc, Fn && fn) : } template< typename T > -pull_coroutine< T >::~pull_coroutine() noexcept { +pull_coroutine< T >::~pull_coroutine() { if ( nullptr != cb_) { cb_->deallocate(); } @@ -128,7 +128,7 @@ pull_coroutine< T & >::pull_coroutine( StackAllocator salloc, Fn && fn) : } template< typename T > -pull_coroutine< T & >::~pull_coroutine() noexcept { +pull_coroutine< T & >::~pull_coroutine() { if ( nullptr != cb_) { cb_->deallocate(); } @@ -189,7 +189,7 @@ pull_coroutine< void >::pull_coroutine( StackAllocator salloc, Fn && fn) : } inline -pull_coroutine< void >::~pull_coroutine() noexcept { +pull_coroutine< void >::~pull_coroutine() { if ( nullptr != cb_) { cb_->deallocate(); } diff --git a/include/boost/coroutine2/detail/push_control_block_ecv2.ipp b/include/boost/coroutine2/detail/push_control_block_ecv2.ipp index f940bb1..7ed6c57 100644 --- a/include/boost/coroutine2/detail/push_control_block_ecv2.ipp +++ b/include/boost/coroutine2/detail/push_control_block_ecv2.ipp @@ -48,7 +48,7 @@ push_coroutine< T >::control_block::control_block( context::preallocated palloc, ctx{ std::allocator_arg, palloc, salloc, std::move( std::bind( - [this]( typename std::decay< Fn >::type & fn_, boost::context::execution_context< T * > ctx, T * data) mutable { + [this]( typename std::decay< Fn >::type & fn_, boost::context::execution_context< T * > && ctx, T * data) mutable { // create synthesized pull_coroutine< T > typename pull_coroutine< T >::control_block synthesized_cb{ this, ctx }; pull_coroutine< T > synthesized{ & synthesized_cb }; @@ -79,7 +79,7 @@ push_coroutine< T >::control_block::control_block( context::preallocated palloc, std::placeholders::_2))}, #else ctx{ std::allocator_arg, palloc, salloc, - [this,fn_=std::forward< Fn >( fn)]( boost::context::execution_context< T * > ctx, T * data) mutable { + [this,fn_=std::forward< Fn >( fn)]( boost::context::execution_context< T * > && ctx, T * data) mutable { // create synthesized pull_coroutine< T > typename pull_coroutine< T >::control_block synthesized_cb{ this, ctx }; pull_coroutine< T > synthesized{ & synthesized_cb }; @@ -178,7 +178,7 @@ push_coroutine< T & >::control_block::control_block( context::preallocated pallo ctx{ std::allocator_arg, palloc, salloc, std::move( std::bind( - [this]( typename std::decay< Fn >::type & fn_, boost::context::execution_context< T * > ctx, T * data) mutable { + [this]( typename std::decay< Fn >::type & fn_, boost::context::execution_context< T * > && ctx, T * data) mutable { // create synthesized pull_coroutine< T & > typename pull_coroutine< T & >::control_block synthesized_cb{ this, ctx }; pull_coroutine< T & > synthesized{ & synthesized_cb }; @@ -209,7 +209,7 @@ push_coroutine< T & >::control_block::control_block( context::preallocated pallo std::placeholders::_2))}, #else ctx{ std::allocator_arg, palloc, salloc, - [this,fn_=std::forward< Fn >( fn)]( boost::context::execution_context< T * > ctx, T * data) mutable { + [this,fn_=std::forward< Fn >( fn)]( boost::context::execution_context< T * > && ctx, T * data) mutable { // create synthesized pull_coroutine< T & > typename pull_coroutine< T & >::control_block synthesized_cb{ this, ctx }; pull_coroutine< T & > synthesized{ & synthesized_cb }; @@ -295,7 +295,7 @@ push_coroutine< void >::control_block::control_block( context::preallocated pall ctx{ std::allocator_arg, palloc, salloc, std::move( std::bind( - [this]( typename std::decay< Fn >::type & fn_, boost::context::execution_context< void > ctx) mutable { + [this]( typename std::decay< Fn >::type & fn_, boost::context::execution_context< void > && ctx) mutable { // create synthesized pull_coroutine< void > typename pull_coroutine< void >::control_block synthesized_cb{ this, ctx }; pull_coroutine< void > synthesized{ & synthesized_cb }; @@ -322,7 +322,7 @@ push_coroutine< void >::control_block::control_block( context::preallocated pall std::placeholders::_1))}, #else ctx{ std::allocator_arg, palloc, salloc, - [this,fn_=std::forward< Fn >( fn)]( boost::context::execution_context< void > ctx) mutable { + [this,fn_=std::forward< Fn >( fn)]( boost::context::execution_context< void > && ctx) mutable { // create synthesized pull_coroutine< void > typename pull_coroutine< void >::control_block synthesized_cb{ this, ctx}; pull_coroutine< void > synthesized{ & synthesized_cb }; diff --git a/include/boost/coroutine2/detail/push_coroutine.hpp b/include/boost/coroutine2/detail/push_coroutine.hpp index 5d9d092..1b62663 100644 --- a/include/boost/coroutine2/detail/push_coroutine.hpp +++ b/include/boost/coroutine2/detail/push_coroutine.hpp @@ -45,7 +45,7 @@ public: template< typename StackAllocator, typename Fn > push_coroutine( StackAllocator, Fn &&); - ~push_coroutine() noexcept; + ~push_coroutine(); push_coroutine( push_coroutine const&) = delete; push_coroutine & operator=( push_coroutine const&) = delete; @@ -125,7 +125,7 @@ public: template< typename StackAllocator, typename Fn > push_coroutine( StackAllocator, Fn &&); - ~push_coroutine() noexcept; + ~push_coroutine(); push_coroutine( push_coroutine const&) = delete; push_coroutine & operator=( push_coroutine const&) = delete; @@ -203,7 +203,7 @@ public: template< typename StackAllocator, typename Fn > push_coroutine( StackAllocator, Fn &&); - ~push_coroutine() noexcept; + ~push_coroutine(); push_coroutine( push_coroutine const&) = delete; push_coroutine & operator=( push_coroutine const&) = delete; diff --git a/include/boost/coroutine2/detail/push_coroutine.ipp b/include/boost/coroutine2/detail/push_coroutine.ipp index 304e077..303961b 100644 --- a/include/boost/coroutine2/detail/push_coroutine.ipp +++ b/include/boost/coroutine2/detail/push_coroutine.ipp @@ -48,7 +48,7 @@ push_coroutine< T >::push_coroutine( StackAllocator salloc, Fn && fn) : } template< typename T > -push_coroutine< T >::~push_coroutine() noexcept { +push_coroutine< T >::~push_coroutine() { if ( nullptr != cb_) { cb_->deallocate(); } @@ -108,7 +108,7 @@ push_coroutine< T & >::push_coroutine( StackAllocator salloc, Fn && fn) : } template< typename T > -push_coroutine< T & >::~push_coroutine() noexcept { +push_coroutine< T & >::~push_coroutine() { if ( nullptr != cb_) { cb_->deallocate(); } @@ -159,7 +159,7 @@ push_coroutine< void >::push_coroutine( StackAllocator salloc, Fn && fn) : } inline -push_coroutine< void >::~push_coroutine() noexcept { +push_coroutine< void >::~push_coroutine() { if ( nullptr != cb_) { cb_->deallocate(); }