Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84417 - branches/release/boost/coroutine/detail
From: oliver.kowalke_at_[hidden]
Date: 2013-05-22 12:15:43


Author: olli
Date: 2013-05-22 12:15:41 EDT (Wed, 22 May 2013)
New Revision: 84417
URL: http://svn.boost.org/trac/boost/changeset/84417

Log:
coroutine: merge from trunk (fix)

Removed:
   branches/release/boost/coroutine/detail/arg.hpp
   branches/release/boost/coroutine/detail/coroutine_base.hpp
   branches/release/boost/coroutine/detail/coroutine_base_resume.hpp
   branches/release/boost/coroutine/detail/coroutine_caller.hpp
   branches/release/boost/coroutine/detail/coroutine_get.hpp
   branches/release/boost/coroutine/detail/coroutine_object.hpp
   branches/release/boost/coroutine/detail/coroutine_object_result_0.ipp
   branches/release/boost/coroutine/detail/coroutine_object_result_1.ipp
   branches/release/boost/coroutine/detail/coroutine_object_result_arity.ipp
   branches/release/boost/coroutine/detail/coroutine_object_void_0.ipp
   branches/release/boost/coroutine/detail/coroutine_object_void_1.ipp
   branches/release/boost/coroutine/detail/coroutine_object_void_arity.ipp
   branches/release/boost/coroutine/detail/coroutine_op.hpp

Deleted: branches/release/boost/coroutine/detail/arg.hpp
==============================================================================
--- branches/release/boost/coroutine/detail/arg.hpp 2013-05-22 12:15:41 EDT (Wed, 22 May 2013)
+++ (empty file)
@@ -1,61 +0,0 @@
-
-// Copyright Oliver Kowalke 2009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-#ifndef BOOST_COROUTINES_DETAIL_ARG_H
-#define BOOST_COROUTINES_DETAIL_ARG_H
-
-#include <boost/config.hpp>
-#include <boost/preprocessor/arithmetic/add.hpp>
-#include <boost/preprocessor/arithmetic/sub.hpp>
-#include <boost/preprocessor/cat.hpp>
-#include <boost/preprocessor/punctuation/comma_if.hpp>
-#include <boost/preprocessor/repetition/repeat_from_to.hpp>
-#include <boost/tuple/tuple.hpp>
-#include <boost/type_traits/function_traits.hpp>
-
-#include <boost/coroutine/detail/config.hpp>
-
-#ifdef BOOST_HAS_ABI_HEADERS
-# include BOOST_ABI_PREFIX
-#endif
-
-namespace boost {
-namespace coroutines {
-namespace detail {
-
-template<
- typename Signature,
- int arity = function_traits< Signature >::arity >
-struct arg;
-
-template< typename Signature >
-struct arg< Signature, 1 >
-{
- typedef typename function_traits< Signature >::arg1_type type;
-};
-
-#define BOOST_CONTEXT_TUPLE_COMMA(n) BOOST_PP_COMMA_IF(BOOST_PP_SUB(n,1))
-#define BOOST_CONTEXT_TUPLE_TYPE(z,n,unused) \
- BOOST_CONTEXT_TUPLE_COMMA(n) typename function_traits< Signature >::BOOST_PP_CAT(BOOST_PP_CAT(arg,n),_type)
-#define BOOST_CONTEXT_TUPLE_TYPES(n) BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(n,1),BOOST_CONTEXT_TUPLE_TYPE,~)
-#define BOOST_CONTEXT_TUPLE(z,n,unused) \
-template< typename Signature > \
-struct arg< Signature, n > \
-{ \
- typedef tuple< BOOST_CONTEXT_TUPLE_TYPES(n) > type; \
-};
-BOOST_PP_REPEAT_FROM_TO(2,11,BOOST_CONTEXT_TUPLE,~)
-#undef BOOST_CONTEXT_TUPLE
-#undef BOOST_CONTEXT_TUPLE_TYPES
-#undef BOOST_CONTEXT_TUPLE_TYPE
-#undef BOOST_CONTEXT_TUPLE_COMMA
-
-}}}
-
-#ifdef BOOST_HAS_ABI_HEADERS
-# include BOOST_ABI_SUFFIX
-#endif
-
-#endif // BOOST_COROUTINES_DETAIL_ARG_H

Deleted: branches/release/boost/coroutine/detail/coroutine_base.hpp
==============================================================================
--- branches/release/boost/coroutine/detail/coroutine_base.hpp 2013-05-22 12:15:41 EDT (Wed, 22 May 2013)
+++ (empty file)
@@ -1,125 +0,0 @@
-
-// Copyright Oliver Kowalke 2009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_COROUTINES_DETAIL_COROUTINE_BASE_H
-#define BOOST_COROUTINES_DETAIL_COROUTINE_BASE_H
-
-#include <boost/assert.hpp>
-#include <boost/config.hpp>
-#include <boost/context/fcontext.hpp>
-#include <boost/exception_ptr.hpp>
-#include <boost/intrusive_ptr.hpp>
-#include <boost/type_traits/function_traits.hpp>
-#include <boost/utility.hpp>
-
-#include <boost/coroutine/detail/config.hpp>
-#include <boost/coroutine/detail/coroutine_context.hpp>
-#include <boost/coroutine/detail/coroutine_base_resume.hpp>
-#include <boost/coroutine/detail/flags.hpp>
-
-#ifdef BOOST_HAS_ABI_HEADERS
-# include BOOST_ABI_PREFIX
-#endif
-
-namespace boost {
-namespace coroutines {
-
-struct stack_context;
-
-namespace detail {
-
-template< typename Signature >
-class coroutine_base : private noncopyable,
- public coroutine_base_resume<
- Signature,
- coroutine_base< Signature >,
- typename function_traits< Signature >::result_type,
- function_traits< Signature >::arity
- >
-{
-public:
- typedef intrusive_ptr< coroutine_base > ptr_t;
-
-private:
- template< typename X, typename Y, typename Z, int >
- friend class coroutine_base_resume;
- template< typename X, typename Y, typename Z, typename A, typename B, typename C, int >
- friend class coroutine_object;
-
- unsigned int use_count_;
- coroutine_context caller_;
- coroutine_context callee_;
- int flags_;
- exception_ptr except_;
-
-protected:
- virtual void deallocate_object() = 0;
-
-public:
- coroutine_base( coroutine_context::ctx_fn fn, stack_context * stack_ctx,
- bool unwind, bool preserve_fpu) :
- coroutine_base_resume<
- Signature,
- coroutine_base< Signature >,
- typename function_traits< Signature >::result_type,
- function_traits< Signature >::arity
- >(),
- use_count_( 0),
- caller_(),
- callee_( fn, stack_ctx),
- flags_( 0),
- except_()
- {
- if ( unwind) flags_ |= flag_force_unwind;
- if ( preserve_fpu) flags_ |= flag_preserve_fpu;
- }
-
- coroutine_base( coroutine_context const& callee, bool unwind, bool preserve_fpu) :
- coroutine_base_resume<
- Signature,
- coroutine_base< Signature >,
- typename function_traits< Signature >::result_type,
- function_traits< Signature >::arity
- >(),
- use_count_( 0),
- caller_(),
- callee_( callee),
- flags_( 0),
- except_()
- {
- if ( unwind) flags_ |= flag_force_unwind;
- if ( preserve_fpu) flags_ |= flag_preserve_fpu;
- }
-
- virtual ~coroutine_base()
- {}
-
- bool force_unwind() const BOOST_NOEXCEPT
- { return 0 != ( flags_ & flag_force_unwind); }
-
- bool unwind_requested() const BOOST_NOEXCEPT
- { return 0 != ( flags_ & flag_unwind_stack); }
-
- bool preserve_fpu() const BOOST_NOEXCEPT
- { return 0 != ( flags_ & flag_preserve_fpu); }
-
- bool is_complete() const BOOST_NOEXCEPT
- { return 0 != ( flags_ & flag_complete); }
-
- friend inline void intrusive_ptr_add_ref( coroutine_base * p) BOOST_NOEXCEPT
- { ++p->use_count_; }
-
- friend inline void intrusive_ptr_release( coroutine_base * p) BOOST_NOEXCEPT
- { if ( --p->use_count_ == 0) p->deallocate_object(); }
-};
-
-}}}
-
-#ifdef BOOST_HAS_ABI_HEADERS
-# include BOOST_ABI_SUFFIX
-#endif
-
-#endif // BOOST_COROUTINES_DETAIL_COROUTINE_BASE_H

Deleted: branches/release/boost/coroutine/detail/coroutine_base_resume.hpp
==============================================================================
--- branches/release/boost/coroutine/detail/coroutine_base_resume.hpp 2013-05-22 12:15:41 EDT (Wed, 22 May 2013)
+++ (empty file)
@@ -1,237 +0,0 @@
-
-// Copyright Oliver Kowalke 2009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_COROUTINES_DETAIL_COROUTINE_BASE_RESUME_H
-#define BOOST_COROUTINES_DETAIL_COROUTINE_BASE_RESUME_H
-
-#include <iterator>
-
-#include <boost/assert.hpp>
-#include <boost/config.hpp>
-#include <boost/context/fcontext.hpp>
-#include <boost/optional.hpp>
-#include <boost/preprocessor/arithmetic/add.hpp>
-#include <boost/preprocessor/arithmetic/sub.hpp>
-#include <boost/preprocessor/cat.hpp>
-#include <boost/preprocessor/punctuation/comma_if.hpp>
-#include <boost/preprocessor/repetition/repeat_from_to.hpp>
-#include <boost/range.hpp>
-
-#include <boost/coroutine/detail/arg.hpp>
-#include <boost/coroutine/detail/config.hpp>
-#include <boost/coroutine/detail/coroutine_context.hpp>
-#include <boost/coroutine/detail/exceptions.hpp>
-#include <boost/coroutine/detail/holder.hpp>
-
-#ifdef BOOST_HAS_ABI_HEADERS
-# include BOOST_ABI_PREFIX
-#endif
-
-namespace boost {
-namespace coroutines {
-namespace detail {
-
-template< typename Signature, typename D, typename Result, int arity >
-class coroutine_base_resume;
-
-template< typename Signature, typename D >
-class coroutine_base_resume< Signature, D, void, 0 >
-{
-public:
- void resume()
- {
- holder< void > hldr_to( & static_cast< D * >( this)->caller_);
- holder< void > * hldr_from(
- reinterpret_cast< holder< void > * >(
- hldr_to.ctx->jump(
- static_cast< D * >( this)->callee_,
- reinterpret_cast< intptr_t >( & hldr_to),
- static_cast< D * >( this)->preserve_fpu() ) ) );
- BOOST_ASSERT( hldr_from->ctx);
- static_cast< D * >( this)->callee_ = * hldr_from->ctx;
- if ( hldr_from->force_unwind) throw forced_unwind();
- if ( static_cast< D * >( this)->except_)
- rethrow_exception( static_cast< D * >( this)->except_);
- }
-};
-
-template< typename Signature, typename D, typename Result >
-class coroutine_base_resume< Signature, D, Result, 0 >
-{
-public:
- void resume()
- {
- BOOST_ASSERT( static_cast< D * >( this));
- BOOST_ASSERT( ! static_cast< D * >( this)->is_complete() );
-
- holder< void > hldr_to( & static_cast< D * >( this)->caller_);
- holder< Result > * hldr_from(
- reinterpret_cast< holder< Result > * >(
- hldr_to.ctx->jump(
- static_cast< D * >( this)->callee_,
- reinterpret_cast< intptr_t >( & hldr_to),
- static_cast< D * >( this)->preserve_fpu() ) ) );
- BOOST_ASSERT( hldr_from->ctx);
- static_cast< D * >( this)->callee_ = * hldr_from->ctx;
- result_ = hldr_from->data;
- if ( hldr_from->force_unwind) throw forced_unwind();
- if ( static_cast< D * >( this)->except_)
- rethrow_exception( static_cast< D * >( this)->except_);
- }
-
-protected:
- template< typename X, typename Y, int >
- friend struct coroutine_get;
-
- optional< Result > result_;
-};
-
-template< typename Signature, typename D >
-class coroutine_base_resume< Signature, D, void, 1 >
-{
-public:
- typedef typename arg< Signature >::type arg_type;
-
- void resume( arg_type a1)
- {
- BOOST_ASSERT( static_cast< D * >( this));
- BOOST_ASSERT( ! static_cast< D * >( this)->is_complete() );
-
- holder< arg_type > hldr_to( & static_cast< D * >( this)->caller_, a1);
- holder< void > * hldr_from(
- reinterpret_cast< holder< void > * >(
- hldr_to.ctx->jump(
- static_cast< D * >( this)->callee_,
- reinterpret_cast< intptr_t >( & hldr_to),
- static_cast< D * >( this)->preserve_fpu() ) ) );
- BOOST_ASSERT( hldr_from->ctx);
- static_cast< D * >( this)->callee_ = * hldr_from->ctx;
- if ( hldr_from->force_unwind) throw forced_unwind();
- if ( static_cast< D * >( this)->except_)
- rethrow_exception( static_cast< D * >( this)->except_);
- }
-};
-
-template< typename Signature, typename D, typename Result >
-class coroutine_base_resume< Signature, D, Result, 1 >
-{
-public:
- typedef typename arg< Signature >::type arg_type;
-
- void resume( arg_type a1)
- {
- BOOST_ASSERT( static_cast< D * >( this));
- BOOST_ASSERT( ! static_cast< D * >( this)->is_complete() );
-
- coroutine_context caller;
- holder< arg_type > hldr_to( & static_cast< D * >( this)->caller_, a1);
- holder< Result > * hldr_from(
- reinterpret_cast< holder< Result > * >(
- hldr_to.ctx->jump(
- static_cast< D * >( this)->callee_,
- reinterpret_cast< intptr_t >( & hldr_to),
- static_cast< D * >( this)->preserve_fpu() ) ) );
- BOOST_ASSERT( hldr_from->ctx);
- static_cast< D * >( this)->callee_ = * hldr_from->ctx;
- result_ = hldr_from->data;
- if ( hldr_from->force_unwind) throw forced_unwind();
- if ( static_cast< D * >( this)->except_)
- rethrow_exception( static_cast< D * >( this)->except_);
- }
-
-protected:
- template< typename X, typename Y, int >
- friend struct coroutine_get;
-
- optional< Result > result_;
-};
-
-#define BOOST_COROUTINE_BASE_RESUME_COMMA(n) BOOST_PP_COMMA_IF(BOOST_PP_SUB(n,1))
-#define BOOST_COROUTINE_BASE_RESUME_VAL(z,n,unused) BOOST_COROUTINE_BASE_RESUME_COMMA(n) BOOST_PP_CAT(a,n)
-#define BOOST_COROUTINE_BASE_RESUME_VALS(n) BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(n,1),BOOST_COROUTINE_BASE_RESUME_VAL,~)
-#define BOOST_COROUTINE_BASE_RESUME_ARG_TYPE(n) \
- typename function_traits< Signature >::BOOST_PP_CAT(BOOST_PP_CAT(arg,n),_type)
-#define BOOST_COROUTINE_BASE_RESUME_ARG(z,n,unused) BOOST_COROUTINE_BASE_RESUME_COMMA(n) BOOST_COROUTINE_BASE_RESUME_ARG_TYPE(n) BOOST_PP_CAT(a,n)
-#define BOOST_COROUTINE_BASE_RESUME_ARGS(n) BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(n,1),BOOST_COROUTINE_BASE_RESUME_ARG,~)
-#define BOOST_COROUTINE_BASE_RESUME(z,n,unused) \
-template< typename Signature, typename D > \
-class coroutine_base_resume< Signature, D, void, n > \
-{ \
-public: \
- typedef typename arg< Signature >::type arg_type; \
-\
- void resume( BOOST_COROUTINE_BASE_RESUME_ARGS(n)) \
- { \
- BOOST_ASSERT( static_cast< D * >( this)); \
- BOOST_ASSERT( ! static_cast< D * >( this)->is_complete() ); \
-\
- holder< arg_type > hldr_to( \
- & static_cast< D * >( this)->caller_, \
- arg_type(BOOST_COROUTINE_BASE_RESUME_VALS(n) ) ); \
- holder< void > * hldr_from( \
- reinterpret_cast< holder< void > * >( \
- hldr_to.ctx->jump( \
- static_cast< D * >( this)->callee_, \
- reinterpret_cast< intptr_t >( & hldr_to), \
- static_cast< D * >( this)->preserve_fpu() ) ) ); \
- BOOST_ASSERT( hldr_from->ctx); \
- static_cast< D * >( this)->callee_ = * hldr_from->ctx; \
- if ( hldr_from->force_unwind) throw forced_unwind(); \
- if ( static_cast< D * >( this)->except_) \
- rethrow_exception( static_cast< D * >( this)->except_); \
- } \
-}; \
-\
-template< typename Signature, typename D, typename Result > \
-class coroutine_base_resume< Signature, D, Result, n > \
-{ \
-public: \
- typedef typename arg< Signature >::type arg_type; \
-\
- void resume( BOOST_COROUTINE_BASE_RESUME_ARGS(n)) \
- { \
- BOOST_ASSERT( static_cast< D * >( this)); \
- BOOST_ASSERT( ! static_cast< D * >( this)->is_complete() ); \
-\
- holder< arg_type > hldr_to( \
- & static_cast< D * >( this)->caller_, \
- arg_type(BOOST_COROUTINE_BASE_RESUME_VALS(n) ) ); \
- holder< Result > * hldr_from( \
- reinterpret_cast< holder< Result > * >( \
- hldr_to.ctx->jump( \
- static_cast< D * >( this)->callee_, \
- reinterpret_cast< intptr_t >( & hldr_to), \
- static_cast< D * >( this)->preserve_fpu() ) ) ); \
- BOOST_ASSERT( hldr_from->ctx); \
- static_cast< D * >( this)->callee_ = * hldr_from->ctx; \
- result_ = hldr_from->data; \
- if ( hldr_from->force_unwind) throw forced_unwind(); \
- if ( static_cast< D * >( this)->except_) \
- rethrow_exception( static_cast< D * >( this)->except_); \
- } \
-\
-protected: \
- template< typename X, typename Y, int > \
- friend struct coroutine_get; \
-\
- optional< Result > result_; \
-};
-BOOST_PP_REPEAT_FROM_TO(2,11,BOOST_COROUTINE_BASE_RESUME,~)
-#undef BOOST_COROUTINE_BASE_RESUME
-#undef BOOST_COROUTINE_BASE_RESUME_ARGS
-#undef BOOST_COROUTINE_BASE_RESUME_ARG
-#undef BOOST_COROUTINE_BASE_RESUME_ARG_TYPE
-#undef BOOST_COROUTINE_BASE_RESUME_VALS
-#undef BOOST_COROUTINE_BASE_RESUME_VAL
-#undef BOOST_COROUTINE_BASE_RESUME_COMMA
-
-}}}
-
-#ifdef BOOST_HAS_ABI_HEADERS
-# include BOOST_ABI_SUFFIX
-#endif
-
-#endif // BOOST_COROUTINES_DETAIL_coroutine_base_resume_H

Deleted: branches/release/boost/coroutine/detail/coroutine_caller.hpp
==============================================================================
--- branches/release/boost/coroutine/detail/coroutine_caller.hpp 2013-05-22 12:15:41 EDT (Wed, 22 May 2013)
+++ (empty file)
@@ -1,57 +0,0 @@
-
-// Copyright Oliver Kowalke 2009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_COROUTINES_DETAIL_COROUTINE_CALLER_H
-#define BOOST_COROUTINES_DETAIL_COROUTINE_CALLER_H
-
-#include <boost/config.hpp>
-#include <boost/context/fcontext.hpp>
-
-#include <boost/coroutine/detail/config.hpp>
-#include <boost/coroutine/detail/coroutine_base.hpp>
-
-#ifdef BOOST_HAS_ABI_HEADERS
-# include BOOST_ABI_PREFIX
-#endif
-
-namespace boost {
-namespace coroutines {
-namespace detail {
-
-template< typename Signature, typename Allocator >
-class coroutine_caller : public coroutine_base< Signature >
-{
-public:
- typedef typename Allocator::template rebind<
- coroutine_caller< Signature, Allocator >
- >::other allocator_t;
-
- coroutine_caller( coroutine_context const& callee, bool unwind, bool preserve_fpu,
- allocator_t const& alloc) BOOST_NOEXCEPT :
- coroutine_base< Signature >( callee, unwind, preserve_fpu),
- alloc_( alloc)
- {}
-
- void deallocate_object()
- { destroy_( alloc_, this); }
-
-private:
- allocator_t alloc_;
-
- static void destroy_( allocator_t & alloc, coroutine_caller * p)
- {
- alloc.destroy( p);
- alloc.deallocate( p, 1);
- }
-};
-
-}}}
-
-#ifdef BOOST_HAS_ABI_HEADERS
-# include BOOST_ABI_SUFFIX
-#endif
-
-#endif // BOOST_COROUTINES_DETAIL_COROUTINE_CALLER_H

Deleted: branches/release/boost/coroutine/detail/coroutine_get.hpp
==============================================================================
--- branches/release/boost/coroutine/detail/coroutine_get.hpp 2013-05-22 12:15:41 EDT (Wed, 22 May 2013)
+++ (empty file)
@@ -1,54 +0,0 @@
-
-// Copyright Oliver Kowalke 2009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_COROUTINES_DETAIL_COROUTINE_GET_H
-#define BOOST_COROUTINES_DETAIL_COROUTINE_GET_H
-
-#include <boost/assert.hpp>
-#include <boost/config.hpp>
-#include <boost/type_traits/function_traits.hpp>
-
-#include <boost/coroutine/detail/config.hpp>
-#include <boost/coroutine/detail/param.hpp>
-
-#ifdef BOOST_HAS_ABI_HEADERS
-# include BOOST_ABI_PREFIX
-#endif
-
-namespace boost {
-namespace coroutines {
-namespace detail {
-
-template<
- typename D,
- typename Result, int arity
->
-struct coroutine_get;
-
-template< typename D, int arity >
-struct coroutine_get< D, void, arity >
-{};
-
-template< typename D, typename Result, int arity >
-struct coroutine_get
-{
- bool has_result() const
- { return static_cast< D const* >( this)->impl_->result_; }
-
- typename param< Result >::type get() const
- {
- BOOST_ASSERT( static_cast< D const* >( this)->impl_->result_);
- return static_cast< D const* >( this)->impl_->result_.get();
- }
-};
-
-}}}
-
-#ifdef BOOST_HAS_ABI_HEADERS
-# include BOOST_ABI_SUFFIX
-#endif
-
-#endif // BOOST_COROUTINES_DETAIL_COROUTINE_GET_H

Deleted: branches/release/boost/coroutine/detail/coroutine_object.hpp
==============================================================================
--- branches/release/boost/coroutine/detail/coroutine_object.hpp 2013-05-22 12:15:41 EDT (Wed, 22 May 2013)
+++ (empty file)
@@ -1,102 +0,0 @@
-
-// Copyright Oliver Kowalke 2009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_COROUTINES_DETAIL_COROUTINE_OBJECT_H
-#define BOOST_COROUTINES_DETAIL_COROUTINE_OBJECT_H
-
-#include <cstddef>
-
-#include <boost/assert.hpp>
-#include <boost/config.hpp>
-#include <boost/cstdint.hpp>
-#include <boost/exception_ptr.hpp>
-#include <boost/move/move.hpp>
-#include <boost/ref.hpp>
-#include <boost/tuple/tuple.hpp>
-#include <boost/type_traits/function_traits.hpp>
-#include <boost/utility.hpp>
-
-#include <boost/coroutine/attributes.hpp>
-#include <boost/coroutine/detail/arg.hpp>
-#include <boost/coroutine/detail/config.hpp>
-#include <boost/coroutine/detail/coroutine_base.hpp>
-#include <boost/coroutine/detail/exceptions.hpp>
-#include <boost/coroutine/detail/flags.hpp>
-#include <boost/coroutine/detail/holder.hpp>
-#include <boost/coroutine/detail/param.hpp>
-#include <boost/coroutine/flags.hpp>
-#include <boost/coroutine/stack_context.hpp>
-
-#ifdef BOOST_HAS_ABI_HEADERS
-# include BOOST_ABI_PREFIX
-#endif
-
-namespace boost {
-namespace coroutines {
-namespace detail {
-
-template< typename Coroutine >
-void trampoline1( intptr_t vp)
-{
- BOOST_ASSERT( vp);
-
- reinterpret_cast< Coroutine * >( vp)->run();
-}
-
-template< typename Coroutine, typename Arg >
-void trampoline2( intptr_t vp)
-{
- BOOST_ASSERT( vp);
-
- tuple< Coroutine *, Arg > * tpl(
- reinterpret_cast< tuple< Coroutine *, Arg > * >( vp) );
- Coroutine * coro( get< 0 >( * tpl) );
- Arg arg( get< 1 >( * tpl) );
-
- coro->run( arg);
-}
-
-template< typename StackAllocator >
-struct stack_tuple
-{
- coroutines::stack_context stack_ctx;
- StackAllocator stack_alloc;
-
- stack_tuple( StackAllocator const& stack_alloc_, std::size_t size) :
- stack_ctx(),
- stack_alloc( stack_alloc_)
- {
- stack_alloc.allocate( stack_ctx, size);
- }
-
- ~stack_tuple()
- {
- stack_alloc.deallocate( stack_ctx);
- }
-};
-
-template<
- typename Signature,
- typename Fn, typename StackAllocator, typename Allocator,
- typename Caller,
- typename Result, int arity
->
-class coroutine_object;
-
-#include <boost/coroutine/detail/coroutine_object_void_0.ipp>
-#include <boost/coroutine/detail/coroutine_object_void_1.ipp>
-#include <boost/coroutine/detail/coroutine_object_void_arity.ipp>
-#include <boost/coroutine/detail/coroutine_object_result_0.ipp>
-#include <boost/coroutine/detail/coroutine_object_result_1.ipp>
-#include <boost/coroutine/detail/coroutine_object_result_arity.ipp>
-
-}}}
-
-#ifdef BOOST_HAS_ABI_HEADERS
-# include BOOST_ABI_SUFFIX
-#endif
-
-#endif // BOOST_COROUTINES_DETAIL_COROUTINE_OBJECT_H

Deleted: branches/release/boost/coroutine/detail/coroutine_object_result_0.ipp
==============================================================================
--- branches/release/boost/coroutine/detail/coroutine_object_result_0.ipp 2013-05-22 12:15:41 EDT (Wed, 22 May 2013)
+++ (empty file)
@@ -1,399 +0,0 @@
-
-// Copyright Oliver Kowalke 2009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-template<
- typename Signature,
- typename Fn, typename StackAllocator, typename Allocator,
- typename Caller,
- typename Result
->
-class coroutine_object< Signature, Fn, StackAllocator, Allocator, Caller, Result, 0 > :
- private stack_tuple< StackAllocator >,
- public coroutine_base< Signature >
-{
-public:
- typedef typename Allocator::template rebind<
- coroutine_object<
- Signature, Fn, StackAllocator, Allocator, Caller, Result, 0
- >
- >::other allocator_t;
-
-private:
- typedef stack_tuple< StackAllocator > pbase_type;
- typedef coroutine_base< Signature > base_type;
-
- Fn fn_;
- allocator_t alloc_;
-
- static void destroy_( allocator_t & alloc, coroutine_object * p)
- {
- alloc.destroy( p);
- alloc.deallocate( p, 1);
- }
-
- coroutine_object( coroutine_object const&);
- coroutine_object & operator=( coroutine_object const&);
-
- void enter_()
- {
- holder< Result > * hldr_from(
- reinterpret_cast< holder< Result > * >(
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( this),
- this->preserve_fpu() ) ) );
- this->callee_ = * hldr_from->ctx;
- this->result_ = hldr_from->data;
- if ( this->except_) rethrow_exception( this->except_);
- }
-
- void run_( Caller & c)
- {
- coroutine_context callee;
- coroutine_context caller;
- try
- {
- fn_( c);
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< Result > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
- catch ( forced_unwind const&)
- {}
- catch (...)
- { this->except_ = current_exception(); }
-
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< Result > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
-
- void unwind_stack_() BOOST_NOEXCEPT
- {
- BOOST_ASSERT( ! this->is_complete() );
-
- this->flags_ |= flag_unwind_stack;
- holder< void > hldr_to( & this->caller_, true);
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- this->flags_ &= ~flag_unwind_stack;
-
- BOOST_ASSERT( this->is_complete() );
- }
-
-public:
-#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
- coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline1< coroutine_object >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( forward< Fn >( fn) ),
- alloc_( alloc)
- { enter_(); }
-#else
- coroutine_object( Fn fn, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline1< coroutine_object >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_(); }
-
- coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline1< coroutine_object >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_(); }
-#endif
-
- ~coroutine_object()
- {
- if ( ! this->is_complete() && this->force_unwind() )
- unwind_stack_();
- }
-
- void run()
- {
- Caller c( this->caller_, false, this->preserve_fpu(), alloc_);
- run_( c);
- }
-
- void deallocate_object()
- { destroy_( alloc_, this); }
-};
-
-template<
- typename Signature,
- typename Fn, typename StackAllocator, typename Allocator,
- typename Caller,
- typename Result
->
-class coroutine_object< Signature, reference_wrapper< Fn >, StackAllocator, Allocator, Caller, Result, 0 > :
- private stack_tuple< StackAllocator >,
- public coroutine_base< Signature >
-{
-public:
- typedef typename Allocator::template rebind<
- coroutine_object<
- Signature, Fn, StackAllocator, Allocator, Caller, Result, 0
- >
- >::other allocator_t;
-
-private:
- typedef stack_tuple< StackAllocator > pbase_type;
- typedef coroutine_base< Signature > base_type;
-
- Fn fn_;
- allocator_t alloc_;
-
- static void destroy_( allocator_t & alloc, coroutine_object * p)
- {
- alloc.destroy( p);
- alloc.deallocate( p, 1);
- }
-
- coroutine_object( coroutine_object const&);
- coroutine_object & operator=( coroutine_object const&);
-
- void enter_()
- {
- holder< Result > * hldr_from(
- reinterpret_cast< holder< Result > * >(
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( this),
- this->preserve_fpu() ) ) );
- this->callee_ = * hldr_from->ctx;
- this->result_ = hldr_from->data;
- if ( this->except_) rethrow_exception( this->except_);
- }
-
- void run_( Caller & c)
- {
- coroutine_context callee;
- coroutine_context caller;
- try
- {
- fn_( c);
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< Result > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
- catch ( forced_unwind const&)
- {}
- catch (...)
- { this->except_ = current_exception(); }
-
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< Result > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
-
- void unwind_stack_() BOOST_NOEXCEPT
- {
- BOOST_ASSERT( ! this->is_complete() );
-
- this->flags_ |= flag_unwind_stack;
- holder< void > hldr_to( & this->caller_, true);
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- this->flags_ &= ~flag_unwind_stack;
-
- BOOST_ASSERT( this->is_complete() );
- }
-
-public:
- coroutine_object( reference_wrapper< Fn > fn, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline1< coroutine_object >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_(); }
-
- ~coroutine_object()
- {
- if ( ! this->is_complete() && this->force_unwind() )
- unwind_stack_();
- }
-
- void run()
- {
- Caller c( this->caller_, false, this->preserve_fpu(), alloc_);
- run_( c);
- }
-
- void deallocate_object()
- { destroy_( alloc_, this); }
-};
-
-template<
- typename Signature,
- typename Fn, typename StackAllocator, typename Allocator,
- typename Caller,
- typename Result
->
-class coroutine_object< Signature, const reference_wrapper< Fn >, StackAllocator, Allocator, Caller, Result, 0 > :
- private stack_tuple< StackAllocator >,
- public coroutine_base< Signature >
-{
-public:
- typedef typename Allocator::template rebind<
- coroutine_object<
- Signature, Fn, StackAllocator, Allocator, Caller, Result, 0
- >
- >::other allocator_t;
-
-private:
- typedef stack_tuple< StackAllocator > pbase_type;
- typedef coroutine_base< Signature > base_type;
-
- Fn fn_;
- allocator_t alloc_;
-
- static void destroy_( allocator_t & alloc, coroutine_object * p)
- {
- alloc.destroy( p);
- alloc.deallocate( p, 1);
- }
-
- coroutine_object( coroutine_object const&);
- coroutine_object & operator=( coroutine_object const&);
-
- void enter_()
- {
- holder< Result > * hldr_from(
- reinterpret_cast< holder< Result > * >(
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( this),
- this->preserve_fpu() ) ) );
- this->callee_ = hldr_from->ctx;
- this->result_ = hldr_from->data;
- if ( this->except_) rethrow_exception( this->except_);
- }
-
- void run_( Caller & c)
- {
- coroutine_context callee;
- coroutine_context caller;
- try
- {
- fn_( c);
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< Result > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
- catch ( forced_unwind const&)
- {}
- catch (...)
- { this->except_ = current_exception(); }
-
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< Result > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
-
- void unwind_stack_() BOOST_NOEXCEPT
- {
- BOOST_ASSERT( ! this->is_complete() );
-
- this->flags_ |= flag_unwind_stack;
- holder< void > hldr_to( & this->caller_, true);
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- this->flags_ &= ~flag_unwind_stack;
-
- BOOST_ASSERT( this->is_complete() );
- }
-
-public:
- coroutine_object( const reference_wrapper< Fn > fn, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline1< coroutine_object >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_(); }
-
- ~coroutine_object()
- {
- if ( ! this->is_complete() && this->force_unwind() )
- unwind_stack_();
- }
-
- void run()
- {
- Caller c( & this->caller_, false, this->preserve_fpu(), alloc_);
- run_( c);
- }
-
- void deallocate_object()
- { destroy_( alloc_, this); }
-};

Deleted: branches/release/boost/coroutine/detail/coroutine_object_result_1.ipp
==============================================================================
--- branches/release/boost/coroutine/detail/coroutine_object_result_1.ipp 2013-05-22 12:15:41 EDT (Wed, 22 May 2013)
+++ (empty file)
@@ -1,536 +0,0 @@
-
-// Copyright Oliver Kowalke 2009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-template<
- typename Signature,
- typename Fn, typename StackAllocator, typename Allocator,
- typename Caller,
- typename Result
->
-class coroutine_object< Signature, Fn, StackAllocator, Allocator, Caller, Result, 1 > :
- private stack_tuple< StackAllocator >,
- public coroutine_base< Signature >
-{
-public:
- typedef typename Allocator::template rebind<
- coroutine_object<
- Signature, Fn, StackAllocator, Allocator, Caller, Result, 1
- >
- >::other allocator_t;
- typedef typename arg< Signature >::type arg_type;
-
-private:
- typedef stack_tuple< StackAllocator > pbase_type;
- typedef coroutine_base< Signature > base_type;
-
- Fn fn_;
- allocator_t alloc_;
-
- static void destroy_( allocator_t & alloc, coroutine_object * p)
- {
- alloc.destroy( p);
- alloc.deallocate( p, 1);
- }
-
- coroutine_object( coroutine_object &);
- coroutine_object & operator=( coroutine_object const&);
-
- void enter_()
- {
- holder< Result > * hldr_from(
- reinterpret_cast< holder< Result > * >(
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( this),
- this->preserve_fpu() ) ) );
- this->callee_ = * hldr_from->ctx;
- this->result_ = hldr_from->data;
- if ( this->except_) rethrow_exception( this->except_);
- }
-
- void enter_( typename detail::param< arg_type >::type arg)
- {
- tuple< coroutine_object *,
- typename detail::param< arg_type >::type
- > tpl( this, arg);
- holder< Result > * hldr_from(
- reinterpret_cast< holder< Result > * >(
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( & tpl),
- this->preserve_fpu() ) ) );
- this->callee_ = * hldr_from->ctx;
- this->result_ = hldr_from->data;
- if ( this->except_) rethrow_exception( this->except_);
- }
-
- void run_( Caller & c)
- {
- coroutine_context callee;
- coroutine_context caller;
- try
- {
- fn_( c);
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< Result > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
- catch ( forced_unwind const&)
- {}
- catch (...)
- { this->except_ = current_exception(); }
-
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< Result > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
-
- void unwind_stack_() BOOST_NOEXCEPT
- {
- BOOST_ASSERT( ! this->is_complete() );
-
- this->flags_ |= flag_unwind_stack;
- holder< arg_type > hldr_to( & this->caller_, true);
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- this->flags_ &= ~flag_unwind_stack;
-
- BOOST_ASSERT( this->is_complete() );
- }
-
-public:
-#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
- coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline1< coroutine_object >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( forward< Fn >( fn) ),
- alloc_( alloc)
- { enter_(); }
-
- coroutine_object( BOOST_RV_REF( Fn) fn, typename detail::param< arg_type >::type arg, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline2< coroutine_object, typename detail::param< arg_type >::type >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( forward< Fn >( fn) ),
- alloc_( alloc)
- { enter_( arg); }
-#else
- coroutine_object( Fn fn, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline1< coroutine_object >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_(); }
-
- coroutine_object( Fn fn, typename detail::param< arg_type >::type arg, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline2< coroutine_object, typename detail::param< arg_type >::type >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_( arg); }
-
- coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline1< coroutine_object >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_(); }
-
- coroutine_object( BOOST_RV_REF( Fn) fn, typename detail::param< arg_type >::type arg, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline2< coroutine_object, typename detail::param< arg_type >::type >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_( arg); }
-#endif
-
- ~coroutine_object()
- {
- if ( ! this->is_complete() && this->force_unwind() )
- unwind_stack_();
- }
-
- void run()
- {
- Caller c( this->caller_, false, this->preserve_fpu(), alloc_);
- run_( c);
- }
-
- void run( typename detail::param< arg_type >::type arg)
- {
- Caller c( this->caller_, false, this->preserve_fpu(), alloc_);
- c.impl_->result_ = arg;
- run_( c);
- }
-
- void deallocate_object()
- { destroy_( alloc_, this); }
-};
-
-template<
- typename Signature,
- typename Fn, typename StackAllocator, typename Allocator,
- typename Caller,
- typename Result
->
-class coroutine_object< Signature, reference_wrapper< Fn >, StackAllocator, Allocator, Caller, Result, 1 > :
- private stack_tuple< StackAllocator >,
- public coroutine_base< Signature >
-{
-public:
- typedef typename Allocator::template rebind<
- coroutine_object<
- Signature, Fn, StackAllocator, Allocator, Caller, Result, 1
- >
- >::other allocator_t;
- typedef typename arg< Signature >::type arg_type;
-
-private:
- typedef stack_tuple< StackAllocator > pbase_type;
- typedef coroutine_base< Signature > base_type;
-
- Fn fn_;
- allocator_t alloc_;
-
- static void destroy_( allocator_t & alloc, coroutine_object * p)
- {
- alloc.destroy( p);
- alloc.deallocate( p, 1);
- }
-
- coroutine_object( coroutine_object &);
- coroutine_object & operator=( coroutine_object const&);
-
- void enter_()
- {
- holder< Result > * hldr_from(
- reinterpret_cast< holder< Result > * >(
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( this),
- this->preserve_fpu() ) ) );
- this->callee_ = * hldr_from->ctx;
- this->result_ = hldr_from->data;
- if ( this->except_) rethrow_exception( this->except_);
- }
-
- void enter_( typename detail::param< arg_type >::type arg)
- {
- tuple< coroutine_object *,
- typename detail::param< arg_type >::type
- > tpl( this, arg);
- holder< Result > * hldr_from(
- reinterpret_cast< holder< Result > * >(
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( & tpl),
- this->preserve_fpu() ) ) );
- this->callee_ = * hldr_from->ctx;
- this->result_ = hldr_from->data;
- if ( this->except_) rethrow_exception( this->except_);
- }
-
- void run_( Caller & c)
- {
- coroutine_context callee;
- coroutine_context caller;
- try
- {
- fn_( c);
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< Result > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
- catch ( forced_unwind const&)
- {}
- catch (...)
- { this->except_ = current_exception(); }
-
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< Result > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
-
- void unwind_stack_() BOOST_NOEXCEPT
- {
- BOOST_ASSERT( ! this->is_complete() );
-
- this->flags_ |= flag_unwind_stack;
- holder< arg_type > hldr_to( & this->caller_, true);
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- this->flags_ &= ~flag_unwind_stack;
-
- BOOST_ASSERT( this->is_complete() );
- }
-
-public:
- coroutine_object( reference_wrapper< Fn > fn, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline1< coroutine_object >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_(); }
-
- coroutine_object( reference_wrapper< Fn > fn, typename detail::param< arg_type >::type arg, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline2< coroutine_object, typename detail::param< arg_type >::type >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_( arg); }
-
- ~coroutine_object()
- {
- if ( ! this->is_complete() && this->force_unwind() )
- unwind_stack_();
- }
-
- void run()
- {
- Caller c( this->caller_, false, this->preserve_fpu(), alloc_);
- run_( c);
- }
-
- void run( typename detail::param< arg_type >::type arg)
- {
- Caller c( this->caller_, false, this->preserve_fpu(), alloc_);
- c.impl_->result_ = arg;
- run_( c);
- }
-
- void deallocate_object()
- { destroy_( alloc_, this); }
-};
-
-template<
- typename Signature,
- typename Fn, typename StackAllocator, typename Allocator,
- typename Caller,
- typename Result
->
-class coroutine_object< Signature, const reference_wrapper< Fn >, StackAllocator, Allocator, Caller, Result, 1 > :
- private stack_tuple< StackAllocator >,
- public coroutine_base< Signature >
-{
-public:
- typedef typename Allocator::template rebind<
- coroutine_object<
- Signature, Fn, StackAllocator, Allocator, Caller, Result, 1
- >
- >::other allocator_t;
- typedef typename arg< Signature >::type arg_type;
-
-private:
- typedef stack_tuple< StackAllocator > pbase_type;
- typedef coroutine_base< Signature > base_type;
-
- Fn fn_;
- allocator_t alloc_;
-
- static void destroy_( allocator_t & alloc, coroutine_object * p)
- {
- alloc.destroy( p);
- alloc.deallocate( p, 1);
- }
-
- coroutine_object( coroutine_object &);
- coroutine_object & operator=( coroutine_object const&);
-
- void enter_()
- {
- holder< Result > * hldr_from(
- reinterpret_cast< holder< Result > * >(
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( this),
- this->preserve_fpu() ) ) );
- this->callee_ = * hldr_from->ctx;
- this->result_ = hldr_from->data;
- if ( this->except_) rethrow_exception( this->except_);
- }
-
- void enter_( typename detail::param< arg_type >::type arg)
- {
- tuple< coroutine_object *,
- typename detail::param< arg_type >::type
- > tpl( this, arg);
- holder< Result > * hldr_from(
- reinterpret_cast< holder< Result > * >(
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( & tpl),
- this->preserve_fpu() ) ) );
- this->callee_ = * hldr_from->ctx;
- this->result_ = hldr_from->data;
- if ( this->except_) rethrow_exception( this->except_);
- }
-
- void run_( Caller & c)
- {
- coroutine_context callee;
- coroutine_context caller;
- try
- {
- fn_( c);
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< Result > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
- catch ( forced_unwind const&)
- {}
- catch (...)
- { this->except_ = current_exception(); }
-
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< Result > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
-
- void unwind_stack_() BOOST_NOEXCEPT
- {
- BOOST_ASSERT( ! this->is_complete() );
-
- this->flags_ |= flag_unwind_stack;
- holder< arg_type > hldr_to( & this->caller_, true);
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- this->flags_ &= ~flag_unwind_stack;
-
- BOOST_ASSERT( this->is_complete() );
- }
-
-public:
- coroutine_object( const reference_wrapper< Fn > fn, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline1< coroutine_object >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_(); }
-
- coroutine_object( const reference_wrapper< Fn > fn, typename detail::param< arg_type >::type arg, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline2< coroutine_object, typename detail::param< arg_type >::type >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_( arg); }
-
- ~coroutine_object()
- {
- if ( ! this->is_complete() && this->force_unwind() )
- unwind_stack_();
- }
-
- void run()
- {
- Caller c( this->caller_, false, this->preserve_fpu(), alloc_);
- run_( c);
- }
-
- void run( typename detail::param< arg_type >::type arg)
- {
- Caller c( this->caller_, false, this->preserve_fpu(), alloc_);
- c.impl_->result_ = arg;
- run_( c);
- }
-
- void deallocate_object()
- { destroy_( alloc_, this); }
-};

Deleted: branches/release/boost/coroutine/detail/coroutine_object_result_arity.ipp
==============================================================================
--- branches/release/boost/coroutine/detail/coroutine_object_result_arity.ipp 2013-05-22 12:15:41 EDT (Wed, 22 May 2013)
+++ (empty file)
@@ -1,536 +0,0 @@
-
-// Copyright Oliver Kowalke 2009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-template<
- typename Signature,
- typename Fn, typename StackAllocator, typename Allocator,
- typename Caller,
- typename Result, int arity
->
-class coroutine_object :
- private stack_tuple< StackAllocator >,
- public coroutine_base< Signature >
-{
-public:
- typedef typename Allocator::template rebind<
- coroutine_object<
- Signature, Fn, StackAllocator, Allocator, Caller, Result, arity
- >
- >::other allocator_t;
- typedef typename arg< Signature >::type arg_type;
-
-private:
- typedef stack_tuple< StackAllocator > pbase_type;
- typedef coroutine_base< Signature > base_type;
-
- Fn fn_;
- allocator_t alloc_;
-
- static void destroy_( allocator_t & alloc, coroutine_object * p)
- {
- alloc.destroy( p);
- alloc.deallocate( p, 1);
- }
-
- coroutine_object( coroutine_object &);
- coroutine_object & operator=( coroutine_object const&);
-
- void enter_()
- {
- holder< Result > * hldr_from(
- reinterpret_cast< holder< Result > * >(
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( this),
- this->preserve_fpu() ) ) );
- this->callee_ = * hldr_from->ctx;
- this->result_ = hldr_from->data;
- if ( this->except_) rethrow_exception( this->except_);
- }
-
- void enter_( typename detail::param< arg_type >::type arg)
- {
- tuple< coroutine_object *,
- typename detail::param< arg_type >::type
- > tpl( this, arg);
- holder< Result > * hldr_from(
- reinterpret_cast< holder< Result > * >(
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( & tpl),
- this->preserve_fpu() ) ) );
- this->callee_ = * hldr_from->ctx;
- this->result_ = hldr_from->data;
- if ( this->except_) rethrow_exception( this->except_);
- }
-
- void run_( Caller & c)
- {
- coroutine_context callee;
- coroutine_context caller;
- try
- {
- fn_( c);
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< Result > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
- catch ( forced_unwind const&)
- {}
- catch (...)
- { this->except_ = current_exception(); }
-
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< Result > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
-
- void unwind_stack_() BOOST_NOEXCEPT
- {
- BOOST_ASSERT( ! this->is_complete() );
-
- this->flags_ |= flag_unwind_stack;
- holder< arg_type > hldr_to( & this->caller_, true);
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- this->flags_ &= ~flag_unwind_stack;
-
- BOOST_ASSERT( this->is_complete() );
- }
-
-public:
-#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
- coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline1< coroutine_object >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( forward< Fn >( fn) ),
- alloc_( alloc)
- { enter_(); }
-
- coroutine_object( BOOST_RV_REF( Fn) fn, typename detail::param< arg_type >::type arg, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline2< coroutine_object, typename detail::param< arg_type >::type >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( forward< Fn >( fn) ),
- alloc_( alloc)
- { enter_( arg); }
-#else
- coroutine_object( Fn fn, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline1< coroutine_object >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_(); }
-
- coroutine_object( Fn fn, typename detail::param< arg_type >::type arg, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline2< coroutine_object, typename detail::param< arg_type >::type >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_( arg); }
-
- coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline1< coroutine_object >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_(); }
-
- coroutine_object( BOOST_RV_REF( Fn) fn, typename detail::param< arg_type >::type arg, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline2< coroutine_object, typename detail::param< arg_type >::type >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_( arg); }
-#endif
-
- ~coroutine_object()
- {
- if ( ! this->is_complete() && this->force_unwind() )
- unwind_stack_();
- }
-
- void run()
- {
- Caller c( this->caller_, false, this->preserve_fpu(), alloc_);
- run_( c);
- }
-
- void run( typename detail::param< arg_type >::type arg)
- {
- Caller c( this->caller_, false, this->preserve_fpu(), alloc_);
- c.impl_->result_ = arg;
- run_( c);
- }
-
- void deallocate_object()
- { destroy_( alloc_, this); }
-};
-
-template<
- typename Signature,
- typename Fn, typename StackAllocator, typename Allocator,
- typename Caller,
- typename Result, int arity
->
-class coroutine_object< Signature, reference_wrapper< Fn >, StackAllocator, Allocator, Caller, Result, arity > :
- private stack_tuple< StackAllocator >,
- public coroutine_base< Signature >
-{
-public:
- typedef typename Allocator::template rebind<
- coroutine_object<
- Signature, Fn, StackAllocator, Allocator, Caller, Result, arity
- >
- >::other allocator_t;
- typedef typename arg< Signature >::type arg_type;
-
-private:
- typedef stack_tuple< StackAllocator > pbase_type;
- typedef coroutine_base< Signature > base_type;
-
- Fn fn_;
- allocator_t alloc_;
-
- static void destroy_( allocator_t & alloc, coroutine_object * p)
- {
- alloc.destroy( p);
- alloc.deallocate( p, 1);
- }
-
- coroutine_object( coroutine_object &);
- coroutine_object & operator=( coroutine_object const&);
-
- void enter_()
- {
- holder< Result > * hldr_from(
- reinterpret_cast< holder< Result > * >(
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( this),
- this->preserve_fpu() ) ) );
- this->callee_ = * hldr_from->ctx;
- this->result_ = hldr_from->data;
- if ( this->except_) rethrow_exception( this->except_);
- }
-
- void enter_( typename detail::param< arg_type >::type arg)
- {
- tuple< coroutine_object *,
- typename detail::param< arg_type >::type
- > tpl( this, arg);
- holder< Result > * hldr_from(
- reinterpret_cast< holder< Result > * >(
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( & tpl),
- this->preserve_fpu() ) ) );
- this->callee_ = * hldr_from->ctx;
- this->result_ = hldr_from->data;
- if ( this->except_) rethrow_exception( this->except_);
- }
-
- void run_( Caller & c)
- {
- coroutine_context callee;
- coroutine_context caller;
- try
- {
- fn_( c);
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< Result > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
- catch ( forced_unwind const&)
- {}
- catch (...)
- { this->except_ = current_exception(); }
-
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< Result > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
-
- void unwind_stack_() BOOST_NOEXCEPT
- {
- BOOST_ASSERT( ! this->is_complete() );
-
- this->flags_ |= flag_unwind_stack;
- holder< arg_type > hldr_to( & this->caller_, true);
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- this->flags_ &= ~flag_unwind_stack;
-
- BOOST_ASSERT( this->is_complete() );
- }
-
-public:
- coroutine_object( reference_wrapper< Fn > fn, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline1< coroutine_object >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_(); }
-
- coroutine_object( reference_wrapper< Fn > fn, typename detail::param< arg_type >::type arg, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline2< coroutine_object, typename detail::param< arg_type >::type >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_( arg); }
-
- ~coroutine_object()
- {
- if ( ! this->is_complete() && this->force_unwind() )
- unwind_stack_();
- }
-
- void run()
- {
- Caller c( this->caller_, false, this->preserve_fpu(), alloc_);
- run_( c);
- }
-
- void run( typename detail::param< arg_type >::type arg)
- {
- Caller c( this->caller_, false, this->preserve_fpu(), alloc_);
- c.impl_->result_ = arg;
- run_( c);
- }
-
- void deallocate_object()
- { destroy_( alloc_, this); }
-};
-
-template<
- typename Signature,
- typename Fn, typename StackAllocator, typename Allocator,
- typename Caller,
- typename Result, int arity
->
-class coroutine_object< Signature, const reference_wrapper< Fn >, StackAllocator, Allocator, Caller, Result, arity > :
- private stack_tuple< StackAllocator >,
- public coroutine_base< Signature >
-{
-public:
- typedef typename Allocator::template rebind<
- coroutine_object<
- Signature, Fn, StackAllocator, Allocator, Caller, Result, arity
- >
- >::other allocator_t;
- typedef typename arg< Signature >::type arg_type;
-
-private:
- typedef stack_tuple< StackAllocator > pbase_type;
- typedef coroutine_base< Signature > base_type;
-
- Fn fn_;
- allocator_t alloc_;
-
- static void destroy_( allocator_t & alloc, coroutine_object * p)
- {
- alloc.destroy( p);
- alloc.deallocate( p, 1);
- }
-
- coroutine_object( coroutine_object &);
- coroutine_object & operator=( coroutine_object const&);
-
- void enter_()
- {
- holder< Result > * hldr_from(
- reinterpret_cast< holder< Result > * >(
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( this),
- this->preserve_fpu() ) ) );
- this->callee_ = * hldr_from->ctx;
- this->result_ = hldr_from->data;
- if ( this->except_) rethrow_exception( this->except_);
- }
-
- void enter_( typename detail::param< arg_type >::type arg)
- {
- tuple< coroutine_object *,
- typename detail::param< arg_type >::type
- > tpl( this, arg);
- holder< Result > * hldr_from(
- reinterpret_cast< holder< Result > * >(
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( & tpl),
- this->preserve_fpu() ) ) );
- this->callee_ = * hldr_from->ctx;
- this->result_ = hldr_from->data;
- if ( this->except_) rethrow_exception( this->except_);
- }
-
- void run_( Caller & c)
- {
- coroutine_context callee;
- coroutine_context caller;
- try
- {
- fn_( c);
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< Result > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
- catch ( forced_unwind const&)
- {}
- catch (...)
- { this->except_ = current_exception(); }
-
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< Result > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
-
- void unwind_stack_() BOOST_NOEXCEPT
- {
- BOOST_ASSERT( ! this->is_complete() );
-
- this->flags_ |= flag_unwind_stack;
- holder< arg_type > hldr_to( & this->caller_, true);
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- this->flags_ &= ~flag_unwind_stack;
-
- BOOST_ASSERT( this->is_complete() );
- }
-
-public:
- coroutine_object( const reference_wrapper< Fn > fn, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline1< coroutine_object >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_(); }
-
- coroutine_object( const reference_wrapper< Fn > fn, typename detail::param< arg_type >::type arg, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline2< coroutine_object, typename detail::param< arg_type >::type >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_( arg); }
-
- ~coroutine_object()
- {
- if ( ! this->is_complete() && this->force_unwind() )
- unwind_stack_();
- }
-
- void run()
- {
- Caller c( this->caller_, false, this->preserve_fpu(), alloc_);
- run_( c);
- }
-
- void run( typename detail::param< arg_type >::type arg)
- {
- Caller c( this->caller_, false, this->preserve_fpu(), alloc_);
- c.impl_->result_ = arg;
- run_( c);
- }
-
- void deallocate_object()
- { destroy_( alloc_, this); }
-};

Deleted: branches/release/boost/coroutine/detail/coroutine_object_void_0.ipp
==============================================================================
--- branches/release/boost/coroutine/detail/coroutine_object_void_0.ipp 2013-05-22 12:15:41 EDT (Wed, 22 May 2013)
+++ (empty file)
@@ -1,393 +0,0 @@
-
-// Copyright Oliver Kowalke 2009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-template<
- typename Signature,
- typename Fn, typename StackAllocator, typename Allocator,
- typename Caller
->
-class coroutine_object< Signature, Fn, StackAllocator, Allocator, Caller, void, 0 > :
- private stack_tuple< StackAllocator >,
- public coroutine_base< Signature >
-{
-public:
- typedef typename Allocator::template rebind<
- coroutine_object<
- Signature, Fn, StackAllocator, Allocator, Caller, void, 0
- >
- >::other allocator_t;
-
-private:
- typedef stack_tuple< StackAllocator > pbase_type;
- typedef coroutine_base< Signature > base_type;
-
- Fn fn_;
- allocator_t alloc_;
-
- static void destroy_( allocator_t & alloc, coroutine_object * p)
- {
- alloc.destroy( p);
- alloc.deallocate( p, 1);
- }
-
- coroutine_object( coroutine_object const&);
- coroutine_object & operator=( coroutine_object const&);
-
- void enter_()
- {
- holder< void > * hldr_from(
- reinterpret_cast< holder< void > * >(
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( this),
- this->preserve_fpu() ) ) );
- this->callee_ = * hldr_from->ctx;
- if ( this->except_) rethrow_exception( this->except_);
- }
-
- void run_( Caller & c)
- {
- coroutine_context callee;
- coroutine_context caller;
- try
- {
- fn_( c);
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< void > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
- catch ( forced_unwind const&)
- {}
- catch (...)
- { this->except_ = current_exception(); }
-
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< void > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
-
- void unwind_stack_() BOOST_NOEXCEPT
- {
- BOOST_ASSERT( ! this->is_complete() );
-
- this->flags_ |= flag_unwind_stack;
- holder< void > hldr_to( & this->caller_, true);
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- this->flags_ &= ~flag_unwind_stack;
-
- BOOST_ASSERT( this->is_complete() );
- }
-
-public:
-#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
- coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline1< coroutine_object >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( forward< Fn >( fn) ),
- alloc_( alloc)
- { enter_(); }
-#else
- coroutine_object( Fn fn, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline1< coroutine_object >,
- & this->pbase_type::stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_(); }
-
- coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline1< coroutine_object >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_(); }
-#endif
-
- ~coroutine_object()
- {
- if ( ! this->is_complete() && this->force_unwind() )
- unwind_stack_();
- }
-
- void run()
- {
- Caller c( this->caller_, false, this->preserve_fpu(), alloc_);
- run_( c);
- }
-
- void deallocate_object()
- { destroy_( alloc_, this); }
-};
-
-template<
- typename Signature,
- typename Fn, typename StackAllocator, typename Allocator,
- typename Caller
->
-class coroutine_object< Signature, reference_wrapper< Fn >, StackAllocator, Allocator, Caller, void, 0 > :
- private stack_tuple< StackAllocator >,
- public coroutine_base< Signature >
-{
-public:
- typedef typename Allocator::template rebind<
- coroutine_object<
- Signature, Fn, StackAllocator, Allocator, Caller, void, 0
- >
- >::other allocator_t;
-
-private:
- typedef stack_tuple< StackAllocator > pbase_type;
- typedef coroutine_base< Signature > base_type;
-
- Fn fn_;
- allocator_t alloc_;
-
- static void destroy_( allocator_t & alloc, coroutine_object * p)
- {
- alloc.destroy( p);
- alloc.deallocate( p, 1);
- }
-
- coroutine_object( coroutine_object const&);
- coroutine_object & operator=( coroutine_object const&);
-
- void enter_()
- {
- holder< void > * hldr_from(
- reinterpret_cast< holder< void > * >(
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( this),
- this->preserve_fpu() ) ) );
- this->callee_ = * hldr_from->ctx;
- if ( this->except_) rethrow_exception( this->except_);
- }
-
- void run_( Caller & c)
- {
- coroutine_context callee;
- coroutine_context caller;
- try
- {
- fn_( c);
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< void > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
- catch ( forced_unwind const&)
- {}
- catch (...)
- { this->except_ = current_exception(); }
-
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< void > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
-
- void unwind_stack_() BOOST_NOEXCEPT
- {
- BOOST_ASSERT( ! this->is_complete() );
-
- this->flags_ |= flag_unwind_stack;
- holder< void > hldr_to( & this->caller_, true);
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- this->flags_ &= ~flag_unwind_stack;
-
- BOOST_ASSERT( this->is_complete() );
- }
-
-public:
- coroutine_object( reference_wrapper< Fn > fn, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline1< coroutine_object >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_(); }
-
- ~coroutine_object()
- {
- if ( ! this->is_complete() && this->force_unwind() )
- unwind_stack_();
- }
-
- void run()
- {
- Caller c( this->caller_, false, this->preserve_fpu(), alloc_);
- run_( c);
- }
-
- void deallocate_object()
- { destroy_( alloc_, this); }
-};
-
-template<
- typename Signature,
- typename Fn, typename StackAllocator, typename Allocator,
- typename Caller
->
-class coroutine_object< Signature, const reference_wrapper< Fn >, StackAllocator, Allocator, Caller, void, 0 > :
- private stack_tuple< StackAllocator >,
- public coroutine_base< Signature >
-{
-public:
- typedef typename Allocator::template rebind<
- coroutine_object<
- Signature, Fn, StackAllocator, Allocator, Caller, void, 0
- >
- >::other allocator_t;
-
-private:
- typedef stack_tuple< StackAllocator > pbase_type;
- typedef coroutine_base< Signature > base_type;
-
- Fn fn_;
- allocator_t alloc_;
-
- static void destroy_( allocator_t & alloc, coroutine_object * p)
- {
- alloc.destroy( p);
- alloc.deallocate( p, 1);
- }
-
- coroutine_object( coroutine_object const&);
- coroutine_object & operator=( coroutine_object const&);
-
- void enter_()
- {
- holder< void > * hldr_from(
- reinterpret_cast< holder< void > * >(
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( this),
- this->preserve_fpu() ) ) );
- this->callee_ = * hldr_from->ctx;
- if ( this->except_) rethrow_exception( this->except_);
- }
-
- void run_( Caller & c)
- {
- coroutine_context callee;
- coroutine_context caller;
- try
- {
- fn_( c);
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< void > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
- catch ( forced_unwind const&)
- {}
- catch (...)
- { this->except_ = current_exception(); }
-
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< void > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
-
- void unwind_stack_() BOOST_NOEXCEPT
- {
- BOOST_ASSERT( ! this->is_complete() );
-
- this->flags_ |= flag_unwind_stack;
- holder< void > hldr_to( & this->caller_, true);
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- this->flags_ &= ~flag_unwind_stack;
-
- BOOST_ASSERT( this->is_complete() );
- }
-
-public:
- coroutine_object( const reference_wrapper< Fn > fn, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline1< coroutine_object >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_(); }
-
- ~coroutine_object()
- {
- if ( ! this->is_complete() && this->force_unwind() )
- unwind_stack_();
- }
-
- void run()
- {
- Caller c( this->caller_, false, this->preserve_fpu(), alloc_);
- run_( c);
- }
-
- void deallocate_object()
- { destroy_( alloc_, this); }
-};

Deleted: branches/release/boost/coroutine/detail/coroutine_object_void_1.ipp
==============================================================================
--- branches/release/boost/coroutine/detail/coroutine_object_void_1.ipp 2013-05-22 12:15:41 EDT (Wed, 22 May 2013)
+++ (empty file)
@@ -1,529 +0,0 @@
-
-// Copyright Oliver Kowalke 2009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-template<
- typename Signature,
- typename Fn, typename StackAllocator, typename Allocator,
- typename Caller
->
-class coroutine_object< Signature, Fn, StackAllocator, Allocator, Caller, void, 1 > :
- private stack_tuple< StackAllocator >,
- public coroutine_base< Signature >
-{
-public:
- typedef typename Allocator::template rebind<
- coroutine_object<
- Signature, Fn, StackAllocator, Allocator, Caller, void, 1
- >
- >::other allocator_t;
- typedef typename arg< Signature >::type arg_type;
-
-private:
- typedef stack_tuple< StackAllocator > pbase_type;
- typedef coroutine_base< Signature > base_type;
-
- Fn fn_;
- allocator_t alloc_;
-
- static void destroy_( allocator_t & alloc, coroutine_object * p)
- {
- alloc.destroy( p);
- alloc.deallocate( p, 1);
- }
-
- coroutine_object( coroutine_object &);
- coroutine_object & operator=( coroutine_object const&);
-
- void enter_()
- {
- holder< void > * hldr_from(
- reinterpret_cast< holder< void > * >(
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( this),
- this->preserve_fpu() ) ) );
- this->callee_ = * hldr_from->ctx;
- if ( this->except_) rethrow_exception( this->except_);
- }
-
- void enter_( typename detail::param< arg_type >::type arg)
- {
- tuple< coroutine_object *,
- typename detail::param< arg_type >::type
- > tpl( this, arg);
- holder< void > * hldr_from(
- reinterpret_cast< holder< void > * >(
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( & tpl),
- this->preserve_fpu() ) ) );
- this->callee_ = * hldr_from->ctx;
- if ( this->except_) rethrow_exception( this->except_);
- }
-
- void run_( Caller & c)
- {
- coroutine_context callee;
- coroutine_context caller;
- try
- {
- fn_( c);
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< void > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
- catch ( forced_unwind const&)
- {}
- catch (...)
- { this->except_ = current_exception(); }
-
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< void > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
-
- void unwind_stack_() BOOST_NOEXCEPT
- {
- BOOST_ASSERT( ! this->is_complete() );
-
- this->flags_ |= flag_unwind_stack;
- holder< arg_type > hldr_to( & this->caller_, true);
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- this->flags_ &= ~flag_unwind_stack;
-
- BOOST_ASSERT( this->is_complete() );
- }
-
-public:
-#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
- coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline1< coroutine_object >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( forward< Fn >( fn) ),
- alloc_( alloc)
- { enter_(); }
-
- coroutine_object( BOOST_RV_REF( Fn) fn, typename detail::param< arg_type >::type arg, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline2< coroutine_object, typename detail::param< arg_type >::type >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( forward< Fn >( fn) ),
- alloc_( alloc)
- { enter_( arg); }
-#else
- coroutine_object( Fn fn, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline1< coroutine_object >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_(); }
-
- coroutine_object( Fn fn, typename detail::param< arg_type >::type arg, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline2< coroutine_object, typename detail::param< arg_type >::type >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_( arg); }
-
- coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline1< coroutine_object >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_(); }
-
- coroutine_object( BOOST_RV_REF( Fn) fn, typename detail::param< arg_type >::type arg, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline2< coroutine_object, typename detail::param< arg_type >::type >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_( arg); }
-#endif
-
- ~coroutine_object()
- {
- if ( ! this->is_complete() && this->force_unwind() )
- unwind_stack_();
- }
-
- void run()
- {
- Caller c( this->caller_, false, this->preserve_fpu(), alloc_);
- run_( c);
- }
-
- void run( typename detail::param< arg_type >::type arg)
- {
- Caller c( this->caller_, false, this->preserve_fpu(), alloc_);
- c.impl_->result_ = arg;
- run_( c);
- }
-
- void deallocate_object()
- { destroy_( alloc_, this); }
-};
-
-template<
- typename Signature,
- typename Fn, typename StackAllocator, typename Allocator,
- typename Caller
->
-class coroutine_object< Signature, reference_wrapper< Fn >, StackAllocator, Allocator, Caller, void, 1 > :
- private stack_tuple< StackAllocator >,
- public coroutine_base< Signature >
-{
-public:
- typedef typename Allocator::template rebind<
- coroutine_object<
- Signature, Fn, StackAllocator, Allocator, Caller, void, 1
- >
- >::other allocator_t;
- typedef typename arg< Signature >::type arg_type;
-
-private:
- typedef stack_tuple< StackAllocator > pbase_type;
- typedef coroutine_base< Signature > base_type;
-
- Fn fn_;
- allocator_t alloc_;
-
- static void destroy_( allocator_t & alloc, coroutine_object * p)
- {
- alloc.destroy( p);
- alloc.deallocate( p, 1);
- }
-
- coroutine_object( coroutine_object &);
- coroutine_object & operator=( coroutine_object const&);
-
- void enter_()
- {
- holder< void > * hldr_from(
- reinterpret_cast< holder< void > * >(
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( this),
- this->preserve_fpu() ) ) );
- this->callee_ = * hldr_from->ctx;
- if ( this->except_) rethrow_exception( this->except_);
- }
-
- void enter_( typename detail::param< arg_type >::type arg)
- {
- tuple< coroutine_object *,
- typename detail::param< arg_type >::type
- > tpl( this, arg);
- holder< void > * hldr_from(
- reinterpret_cast< holder< void > * >(
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( & tpl),
- this->preserve_fpu() ) ) );
- this->callee_ = * hldr_from->ctx;
- if ( this->except_) rethrow_exception( this->except_);
- }
-
- void run_( Caller & c)
- {
- coroutine_context callee;
- coroutine_context caller;
- try
- {
- fn_( c);
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< void > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
- catch ( forced_unwind const&)
- {}
- catch (...)
- { this->except_ = current_exception(); }
-
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< void > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
-
- void unwind_stack_() BOOST_NOEXCEPT
- {
- BOOST_ASSERT( ! this->is_complete() );
-
- this->flags_ |= flag_unwind_stack;
- holder< arg_type > hldr_to( & this->caller_, true);
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- this->flags_ &= ~flag_unwind_stack;
-
- BOOST_ASSERT( this->is_complete() );
- }
-
-public:
- coroutine_object( reference_wrapper< Fn > fn, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline1< coroutine_object >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_(); }
-
- coroutine_object( reference_wrapper< Fn > fn,
- typename detail::param< arg_type >::type arg, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline2< coroutine_object, typename detail::param< arg_type >::type >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_( arg); }
-
- ~coroutine_object()
- {
- if ( ! this->is_complete() && this->force_unwind() )
- unwind_stack_();
- }
-
- void run()
- {
- Caller c( this->caller_, false, this->preserve_fpu(), alloc_);
- run_( c);
- }
-
- void run( typename detail::param< arg_type >::type arg)
- {
- Caller c( this->caller_, false, this->preserve_fpu(), alloc_);
- c.impl_->result_ = arg;
- run_( c);
- }
-
- void deallocate_object()
- { destroy_( alloc_, this); }
-};
-
-template<
- typename Signature,
- typename Fn, typename StackAllocator, typename Allocator,
- typename Caller
->
-class coroutine_object< Signature, const reference_wrapper< Fn >, StackAllocator, Allocator, Caller, void, 1 > :
- private stack_tuple< StackAllocator >,
- public coroutine_base< Signature >
-{
-public:
- typedef typename Allocator::template rebind<
- coroutine_object<
- Signature, Fn, StackAllocator, Allocator, Caller, void, 1
- >
- >::other allocator_t;
- typedef typename arg< Signature >::type arg_type;
-
-private:
- typedef stack_tuple< StackAllocator > pbase_type;
- typedef coroutine_base< Signature > base_type;
-
- Fn fn_;
- allocator_t alloc_;
-
- static void destroy_( allocator_t & alloc, coroutine_object * p)
- {
- alloc.destroy( p);
- alloc.deallocate( p, 1);
- }
-
- coroutine_object( coroutine_object &);
- coroutine_object & operator=( coroutine_object const&);
-
- void enter_()
- {
- holder< void > * hldr_from(
- reinterpret_cast< holder< void > * >(
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( this),
- this->preserve_fpu() ) ) );
- this->callee_ = * hldr_from->ctx;
- if ( this->except_) rethrow_exception( this->except_);
- }
-
- void enter_( typename detail::param< arg_type >::type arg)
- {
- tuple< coroutine_object *,
- typename detail::param< arg_type >::type
- > tpl( this, arg);
- holder< void > * hldr_from(
- reinterpret_cast< holder< void > * >(
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( & tpl),
- this->preserve_fpu() ) ) );
- this->callee_ = * hldr_from->ctx;
- if ( this->except_) rethrow_exception( this->except_);
- }
-
- void run_( Caller & c)
- {
- coroutine_context callee;
- coroutine_context caller;
- try
- {
- fn_( c);
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< void > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
- catch ( forced_unwind const&)
- {}
- catch (...)
- { this->except_ = current_exception(); }
-
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< void > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
-
- void unwind_stack_() BOOST_NOEXCEPT
- {
- BOOST_ASSERT( ! this->is_complete() );
-
- this->flags_ |= flag_unwind_stack;
- holder< arg_type > hldr_to( & this->caller_, true);
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- this->flags_ &= ~flag_unwind_stack;
-
- BOOST_ASSERT( this->is_complete() );
- }
-
-public:
- coroutine_object( const reference_wrapper< Fn > fn, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline1< coroutine_object >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_(); }
-
- coroutine_object( const reference_wrapper< Fn > fn,
- typename detail::param< arg_type >::type arg, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline2< coroutine_object, typename detail::param< arg_type >::type >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_( arg); }
-
- ~coroutine_object()
- {
- if ( ! this->is_complete() && this->force_unwind() )
- unwind_stack_();
- }
-
- void run()
- {
- Caller c( this->caller_, false, this->preserve_fpu(), alloc_);
- run_( c);
- }
-
- void run( typename detail::param< arg_type >::type arg)
- {
- Caller c( this->caller_, false, this->preserve_fpu(), alloc_);
- c.impl_->result_ = arg;
- run_( c);
- }
-
- void deallocate_object()
- { destroy_( alloc_, this); }
-};

Deleted: branches/release/boost/coroutine/detail/coroutine_object_void_arity.ipp
==============================================================================
--- branches/release/boost/coroutine/detail/coroutine_object_void_arity.ipp 2013-05-22 12:15:41 EDT (Wed, 22 May 2013)
+++ (empty file)
@@ -1,530 +0,0 @@
-
-// Copyright Oliver Kowalke 2009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-template<
- typename Signature,
- typename Fn, typename StackAllocator, typename Allocator,
- typename Caller,
- int arity
->
-class coroutine_object< Signature, Fn, StackAllocator, Allocator, Caller, void, arity > :
- private stack_tuple< StackAllocator >,
- public coroutine_base< Signature >
-{
-public:
- typedef typename Allocator::template rebind<
- coroutine_object<
- Signature, Fn, StackAllocator, Allocator, Caller, void, arity
- >
- >::other allocator_t;
- typedef typename arg< Signature >::type arg_type;
-
-private:
- typedef stack_tuple< StackAllocator > pbase_type;
- typedef coroutine_base< Signature > base_type;
-
- Fn fn_;
- allocator_t alloc_;
-
- static void destroy_( allocator_t & alloc, coroutine_object * p)
- {
- alloc.destroy( p);
- alloc.deallocate( p, 1);
- }
-
- coroutine_object( coroutine_object &);
- coroutine_object & operator=( coroutine_object const&);
-
- void enter_()
- {
- holder< void > * hldr_from(
- reinterpret_cast< holder< void > * >(
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( this),
- this->preserve_fpu() ) ) );
- this->callee_ = * hldr_from->ctx;
- if ( this->except_) rethrow_exception( this->except_);
- }
-
- void enter_( typename detail::param< arg_type >::type arg)
- {
- tuple< coroutine_object *,
- typename detail::param< arg_type >::type
- > tpl( this, arg);
- holder< void > * hldr_from(
- reinterpret_cast< holder< void > * >(
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( & tpl),
- this->preserve_fpu() ) ) );
- this->callee_ = * hldr_from->ctx;
- if ( this->except_) rethrow_exception( this->except_);
- }
-
- void run_( Caller & c)
- {
- coroutine_context callee;
- coroutine_context caller;
- try
- {
- fn_( c);
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< void > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
- catch ( forced_unwind const&)
- {}
- catch (...)
- { this->except_ = current_exception(); }
-
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< void > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
-
- void unwind_stack_() BOOST_NOEXCEPT
- {
- BOOST_ASSERT( ! this->is_complete() );
-
- this->flags_ |= flag_unwind_stack;
- holder< arg_type > hldr_to( & this->caller_, true);
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- this->flags_ &= ~flag_unwind_stack;
-
- BOOST_ASSERT( this->is_complete() );
- }
-
-public:
-#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
- coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline1< coroutine_object >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( forward< Fn >( fn) ),
- alloc_( alloc)
- { enter_(); }
-
- coroutine_object( BOOST_RV_REF( Fn) fn, typename detail::param< arg_type >::type arg, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline2< coroutine_object, typename detail::param< arg_type >::type >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( forward< Fn >( fn) ),
- alloc_( alloc)
- { enter_( arg); }
-#else
- coroutine_object( Fn fn, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline1< coroutine_object >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_(); }
-
- coroutine_object( Fn fn, typename detail::param< arg_type >::type arg, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline2< coroutine_object, typename detail::param< arg_type >::type >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_( arg); }
-
- coroutine_object( BOOST_RV_REF( Fn) fn, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline1< coroutine_object >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_(); }
-
- coroutine_object( BOOST_RV_REF( Fn) fn, typename detail::param< arg_type >::type arg, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline2< coroutine_object, typename detail::param< arg_type >::type >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_( arg); }
-#endif
-
- ~coroutine_object()
- {
- if ( ! this->is_complete() && this->force_unwind() )
- unwind_stack_();
- }
-
- void run()
- {
- Caller c( this->caller_, false, this->preserve_fpu(), alloc_);
- run_( c);
- }
-
- void run( typename detail::param< arg_type >::type arg)
- {
- Caller c( this->caller_, false, this->preserve_fpu(), alloc_);
- c.impl_->result_ = arg;
- run_( c);
- }
-
- void deallocate_object()
- { destroy_( alloc_, this); }
-};
-
-template<
- typename Signature,
- typename Fn, typename StackAllocator, typename Allocator,
- typename Caller,
- int arity
->
-class coroutine_object< Signature, reference_wrapper< Fn >, StackAllocator, Allocator, Caller, void, arity > :
- private stack_tuple< StackAllocator >,
- public coroutine_base< Signature >
-{
-public:
- typedef typename Allocator::template rebind<
- coroutine_object<
- Signature, Fn, StackAllocator, Allocator, Caller, void, arity
- >
- >::other allocator_t;
- typedef typename arg< Signature >::type arg_type;
-
-private:
- typedef stack_tuple< StackAllocator > pbase_type;
- typedef coroutine_base< Signature > base_type;
-
- Fn fn_;
- allocator_t alloc_;
-
- static void destroy_( allocator_t & alloc, coroutine_object * p)
- {
- alloc.destroy( p);
- alloc.deallocate( p, 1);
- }
-
- coroutine_object( coroutine_object &);
- coroutine_object & operator=( coroutine_object const&);
-
- void enter_()
- {
- holder< void > * hldr_from(
- reinterpret_cast< holder< void > * >(
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( this),
- this->preserve_fpu() ) ) );
- this->callee_ = * hldr_from->ctx;
- if ( this->except_) rethrow_exception( this->except_);
- }
-
- void enter_( typename detail::param< arg_type >::type arg)
- {
- tuple< coroutine_object *,
- typename detail::param< arg_type >::type
- > tpl( this, arg);
- holder< void > * hldr_from(
- reinterpret_cast< holder< void > * >(
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( & tpl),
- this->preserve_fpu() ) ) );
- this->callee_ = * hldr_from->ctx;
- if ( this->except_) rethrow_exception( this->except_);
- }
-
- void run_( Caller & c)
- {
- coroutine_context callee;
- coroutine_context caller;
- try
- {
- fn_( c);
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< void > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
- catch ( forced_unwind const&)
- {}
- catch (...)
- { this->except_ = current_exception(); }
-
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< void > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
-
- void unwind_stack_() BOOST_NOEXCEPT
- {
- BOOST_ASSERT( ! this->is_complete() );
-
- this->flags_ |= flag_unwind_stack;
- holder< arg_type > hldr_to( & this->caller_, true);
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- this->flags_ &= ~flag_unwind_stack;
-
- BOOST_ASSERT( this->is_complete() );
- }
-
-public:
- coroutine_object( reference_wrapper< Fn > fn, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline1< coroutine_object >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_(); }
-
- coroutine_object( reference_wrapper< Fn > fn, typename detail::param< arg_type >::type arg, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline2< coroutine_object, typename detail::param< arg_type >::type >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_( arg); }
-
- ~coroutine_object()
- {
- if ( ! this->is_complete() && this->force_unwind() )
- unwind_stack_();
- }
-
- void run()
- {
- Caller c( this->caller_, false, this->preserve_fpu(), alloc_);
- run_( c);
- }
-
- void run( typename detail::param< arg_type >::type arg)
- {
- Caller c( this->caller_, false, this->preserve_fpu(), alloc_);
- c.impl_->result_ = arg;
- run_( c);
- }
-
- void deallocate_object()
- { destroy_( alloc_, this); }
-};
-
-template<
- typename Signature,
- typename Fn, typename StackAllocator, typename Allocator,
- typename Caller,
- int arity
->
-class coroutine_object< Signature, const reference_wrapper< Fn >, StackAllocator, Allocator, Caller, void, arity > :
- private stack_tuple< StackAllocator >,
- public coroutine_base< Signature >
-{
-public:
- typedef typename Allocator::template rebind<
- coroutine_object<
- Signature, Fn, StackAllocator, Allocator, Caller, void, arity
- >
- >::other allocator_t;
- typedef typename arg< Signature >::type arg_type;
-
-private:
- typedef stack_tuple< StackAllocator > pbase_type;
- typedef coroutine_base< Signature > base_type;
-
- Fn fn_;
- allocator_t alloc_;
-
- static void destroy_( allocator_t & alloc, coroutine_object * p)
- {
- alloc.destroy( p);
- alloc.deallocate( p, 1);
- }
-
- coroutine_object( coroutine_object &);
- coroutine_object & operator=( coroutine_object const&);
-
- void enter_()
- {
- holder< void > * hldr_from(
- reinterpret_cast< holder< void > * >(
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( this),
- this->preserve_fpu() ) ) );
- this->callee_ = * hldr_from->ctx;
- if ( this->except_) rethrow_exception( this->except_);
- }
-
- void enter_( typename detail::param< arg_type >::type arg)
- {
- tuple< coroutine_object *,
- typename detail::param< arg_type >::type
- > tpl( this, arg);
- holder< void > * hldr_from(
- reinterpret_cast< holder< void > * >(
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( & tpl),
- this->preserve_fpu() ) ) );
- this->callee_ = * hldr_from->ctx;
- if ( this->except_) rethrow_exception( this->except_);
- }
-
- void run_( Caller & c)
- {
- coroutine_context callee;
- coroutine_context caller;
- try
- {
- fn_( c);
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< void > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
- catch ( forced_unwind const&)
- {}
- catch (...)
- { this->except_ = current_exception(); }
-
- this->flags_ |= flag_complete;
- callee = c.impl_->callee_;
- holder< void > hldr_to( & caller);
- caller.jump(
- callee,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- BOOST_ASSERT_MSG( false, "coroutine is complete");
- }
-
- void unwind_stack_() BOOST_NOEXCEPT
- {
- BOOST_ASSERT( ! this->is_complete() );
-
- this->flags_ |= flag_unwind_stack;
- holder< arg_type > hldr_to( & this->caller_, true);
- this->caller_.jump(
- this->callee_,
- reinterpret_cast< intptr_t >( & hldr_to),
- this->preserve_fpu() );
- this->flags_ &= ~flag_unwind_stack;
-
- BOOST_ASSERT( this->is_complete() );
- }
-
-public:
- coroutine_object( const reference_wrapper< Fn > fn, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline1< coroutine_object >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_(); }
-
- coroutine_object( const reference_wrapper< Fn > fn, typename detail::param< arg_type >::type arg, attributes const& attr,
- StackAllocator const& stack_alloc,
- allocator_t const& alloc) :
- pbase_type( stack_alloc, attr.size),
- base_type(
- trampoline2< coroutine_object, typename detail::param< arg_type >::type >,
- & this->stack_ctx,
- stack_unwind == attr.do_unwind,
- fpu_preserved == attr.preserve_fpu),
- fn_( fn),
- alloc_( alloc)
- { enter_( arg); }
-
- ~coroutine_object()
- {
- if ( ! this->is_complete() && this->force_unwind() )
- unwind_stack_();
- }
-
- void run()
- {
- Caller c( this->caller_, false, this->preserve_fpu(), alloc_);
- run_( c);
- }
-
- void run( typename detail::param< arg_type >::type arg)
- {
- Caller c( this->caller_, false, this->preserve_fpu(), alloc_);
- c.impl_->result_ = arg;
- run_( c);
- }
-
- void deallocate_object()
- { destroy_( alloc_, this); }
-};

Deleted: branches/release/boost/coroutine/detail/coroutine_op.hpp
==============================================================================
--- branches/release/boost/coroutine/detail/coroutine_op.hpp 2013-05-22 12:15:41 EDT (Wed, 22 May 2013)
+++ (empty file)
@@ -1,326 +0,0 @@
-
-// Copyright Oliver Kowalke 2009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_COROUTINES_DETAIL_COROUTINE_OP_H
-#define BOOST_COROUTINES_DETAIL_COROUTINE_OP_H
-
-#include <iterator>
-
-#include <boost/assert.hpp>
-#include <boost/config.hpp>
-#include <boost/context/fcontext.hpp>
-#include <boost/optional.hpp>
-#include <boost/preprocessor/arithmetic/add.hpp>
-#include <boost/preprocessor/arithmetic/sub.hpp>
-#include <boost/preprocessor/cat.hpp>
-#include <boost/preprocessor/punctuation/comma_if.hpp>
-#include <boost/preprocessor/repetition/repeat_from_to.hpp>
-#include <boost/type_traits/function_traits.hpp>
-#include <boost/type_traits/remove_reference.hpp>
-
-#include <boost/coroutine/detail/arg.hpp>
-#include <boost/coroutine/detail/config.hpp>
-
-#ifdef BOOST_HAS_ABI_HEADERS
-# include BOOST_ABI_PREFIX
-#endif
-
-namespace boost {
-namespace coroutines {
-namespace detail {
-
-template< typename Signature, typename D, typename Result, int arity >
-struct coroutine_op;
-
-template< typename Signature, typename D >
-struct coroutine_op< Signature, D, void, 0 >
-{
- D & operator()()
- {
- BOOST_ASSERT( static_cast< D * >( this)->impl_);
- BOOST_ASSERT( ! static_cast< D * >( this)->impl_->is_complete() );
-
- static_cast< D * >( this)->impl_->resume();
-
- return * static_cast< D * >( this);
- }
-};
-
-template< typename Signature, typename D, typename Result >
-struct coroutine_op< Signature, D, Result, 0 >
-{
- class iterator : public std::iterator< std::input_iterator_tag, typename remove_reference< Result >::type >
- {
- private:
- D * dp_;
- optional< Result > val_;
-
- void fetch_()
- {
- BOOST_ASSERT( dp_);
-
- if ( ! dp_->has_result() )
- {
- dp_ = 0;
- val_ = none;
- return;
- }
- val_ = dp_->get();
- }
-
- void increment_()
- {
- BOOST_ASSERT( dp_);
- BOOST_ASSERT( * dp_);
-
- ( * dp_)();
- fetch_();
- }
-
- public:
- typedef typename iterator::pointer pointer_t;
- typedef typename iterator::reference reference_t;
-
- iterator() :
- dp_( 0), val_()
- {}
-
- explicit iterator( D * dp) :
- dp_( dp), val_()
- { fetch_(); }
-
- iterator( iterator const& other) :
- dp_( other.dp_), val_( other.val_)
- {}
-
- iterator & operator=( iterator const& other)
- {
- if ( this == & other) return * this;
- dp_ = other.dp_;
- val_ = other.val_;
- return * this;
- }
-
- bool operator==( iterator const& other)
- { return other.dp_ == dp_ && other.val_ == val_; }
-
- bool operator!=( iterator const& other)
- { return other.dp_ != dp_ || other.val_ != val_; }
-
- iterator & operator++()
- {
- increment_();
- return * this;
- }
-
- iterator operator++( int)
- {
- iterator tmp( * this);
- ++*this;
- return tmp;
- }
-
- reference_t operator*() const
- { return const_cast< optional< Result > & >( val_).get(); }
-
- pointer_t operator->() const
- { return const_cast< optional< Result > & >( val_).get_ptr(); }
- };
-
- class const_iterator : public std::iterator< std::input_iterator_tag, const typename remove_reference< Result >::type >
- {
- private:
- D * dp_;
- optional< Result > val_;
-
- void fetch_()
- {
- BOOST_ASSERT( dp_);
-
- if ( ! dp_->has_result() )
- {
- dp_ = 0;
- val_ = none;
- return;
- }
- val_ = dp_->get();
- }
-
- void increment_()
- {
- BOOST_ASSERT( dp_);
- BOOST_ASSERT( * dp_);
-
- ( * dp_)();
- fetch_();
- }
-
- public:
- typedef typename const_iterator::pointer pointer_t;
- typedef typename const_iterator::reference reference_t;
-
- const_iterator() :
- dp_( 0), val_()
- {}
-
- explicit const_iterator( D const* dp) :
- dp_( const_cast< D * >( dp) ), val_()
- { fetch_(); }
-
- const_iterator( const_iterator const& other) :
- dp_( other.dp_), val_( other.val_)
- {}
-
- const_iterator & operator=( const_iterator const& other)
- {
- if ( this == & other) return * this;
- dp_ = other.dp_;
- val_ = other.val_;
- return * this;
- }
-
- bool operator==( const_iterator const& other)
- { return other.dp_ == dp_ && other.val_ == val_; }
-
- bool operator!=( const_iterator const& other)
- { return other.dp_ != dp_ || other.val_ != val_; }
-
- const_iterator & operator++()
- {
- increment_();
- return * this;
- }
-
- const_iterator operator++( int)
- {
- const_iterator tmp( * this);
- ++*this;
- return tmp;
- }
-
- reference_t operator*() const
- { return val_.get(); }
-
- pointer_t operator->() const
- { return val_.get_ptr(); }
- };
-
- D & operator()()
- {
- BOOST_ASSERT( static_cast< D * >( this)->impl_);
- BOOST_ASSERT( ! static_cast< D * >( this)->impl_->is_complete() );
-
- static_cast< D * >( this)->impl_->resume();
-
- return * static_cast< D * >( this);
- }
-};
-
-template< typename Signature, typename D >
-struct coroutine_op< Signature, D, void, 1 >
-{
- typedef typename arg< Signature >::type arg_type;
-
- class iterator : public std::iterator< std::output_iterator_tag, void, void, void, void >
- {
- private:
- D * dp_;
-
- public:
- iterator() :
- dp_( 0)
- {}
-
- explicit iterator( D * dp) :
- dp_( dp)
- {}
-
- iterator & operator=( arg_type a1)
- {
- BOOST_ASSERT( dp_);
- if ( ! ( * dp_)( a1) ) dp_ = 0;
- return * this;
- }
-
- bool operator==( iterator const& other)
- { return other.dp_ == dp_; }
-
- bool operator!=( iterator const& other)
- { return other.dp_ != dp_; }
-
- iterator & operator*()
- { return * this; }
-
- iterator & operator++()
- { return * this; }
- };
-
- struct const_iterator;
-
- D & operator()( arg_type a1)
- {
- BOOST_ASSERT( static_cast< D * >( this)->impl_);
- BOOST_ASSERT( ! static_cast< D * >( this)->impl_->is_complete() );
-
- static_cast< D * >( this)->impl_->resume( a1);
-
- return * static_cast< D * >( this);
- }
-};
-
-template< typename Signature, typename D, typename Result >
-struct coroutine_op< Signature, D, Result, 1 >
-{
- typedef typename arg< Signature >::type arg_type;
-
- D & operator()( arg_type a1)
- {
- BOOST_ASSERT( static_cast< D * >( this)->impl_);
- BOOST_ASSERT( ! static_cast< D * >( this)->impl_->is_complete() );
-
- static_cast< D * >( this)->impl_->resume( a1);
-
- return * static_cast< D * >( this);
- }
-};
-
-#define BOOST_COROUTINE_OP_COMMA(n) BOOST_PP_COMMA_IF(BOOST_PP_SUB(n,1))
-#define BOOST_COROUTINE_OP_VAL(z,n,unused) BOOST_COROUTINE_OP_COMMA(n) BOOST_PP_CAT(a,n)
-#define BOOST_COROUTINE_OP_VALS(n) BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(n,1),BOOST_COROUTINE_OP_VAL,~)
-#define BOOST_COROUTINE_OP_ARG_TYPE(n) \
- typename function_traits< Signature >::BOOST_PP_CAT(BOOST_PP_CAT(arg,n),_type)
-#define BOOST_COROUTINE_OP_ARG(z,n,unused) BOOST_COROUTINE_OP_COMMA(n) BOOST_COROUTINE_OP_ARG_TYPE(n) BOOST_PP_CAT(a,n)
-#define BOOST_COROUTINE_OP_ARGS(n) BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(n,1),BOOST_COROUTINE_OP_ARG,~)
-#define BOOST_COROUTINE_OP(z,n,unused) \
-template< typename Signature, typename D, typename Result > \
-struct coroutine_op< Signature, D, Result, n > \
-{ \
- D & operator()( BOOST_COROUTINE_OP_ARGS(n)) \
- { \
- BOOST_ASSERT( static_cast< D * >( this)->impl_); \
- BOOST_ASSERT( ! static_cast< D * >( this)->impl_->is_complete() ); \
-\
- static_cast< D * >( this)->impl_->resume(BOOST_COROUTINE_OP_VALS(n)); \
-\
- return * static_cast< D * >( this); \
- } \
-};
-BOOST_PP_REPEAT_FROM_TO(2,11,BOOST_COROUTINE_OP,~)
-#undef BOOST_COROUTINE_OP
-#undef BOOST_COROUTINE_OP_ARGS
-#undef BOOST_COROUTINE_OP_ARG
-#undef BOOST_COROUTINE_OP_ARG_TYPE
-#undef BOOST_COROUTINE_OP_VALS
-#undef BOOST_COROUTINE_OP_VAL
-#undef BOOST_COROUTINE_OP_COMMA
-
-}}}
-
-#ifdef BOOST_HAS_ABI_HEADERS
-# include BOOST_ABI_SUFFIX
-#endif
-
-#endif // BOOST_COROUTINES_DETAIL_COROUTINE_OP_H


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk