|
Index: boost_1_64_0/boost/context/continuation.hpp
|
|
===================================================================
|
|
--- boost_1_64_0.orig/boost/context/continuation.hpp 2017-04-24 12:36:55.987412031 +0100
|
|
+++ boost_1_64_0/boost/context/continuation.hpp 2017-04-24 12:37:49.730416122 +0100
|
|
@@ -56,7 +56,7 @@
|
|
namespace context {
|
|
namespace detail {
|
|
|
|
-template< int N >
|
|
+template<typename U>
|
|
struct helper {
|
|
template< typename T >
|
|
static T convert( T && t) noexcept {
|
|
@@ -64,8 +64,8 @@
|
|
}
|
|
};
|
|
|
|
-template<>
|
|
-struct helper< 1 > {
|
|
+template<typename U>
|
|
+struct helper< std::tuple<U> > {
|
|
template< typename T >
|
|
static std::tuple< T > convert( T && t) noexcept {
|
|
return std::make_tuple( std::forward< T >( t) );
|
|
@@ -239,15 +239,16 @@
|
|
|
|
}
|
|
|
|
-template< typename Ctx, typename Fn, typename ... Arg >
|
|
+template< typename Ctx, typename Fn, typename Arg >
|
|
detail::transfer_t context_ontop( detail::transfer_t t) {
|
|
- auto p = static_cast< std::tuple< Fn, std::tuple< Arg ... > > * >( t.data);
|
|
+ auto p = static_cast< Arg * >( t.data);
|
|
BOOST_ASSERT( nullptr != p);
|
|
typename std::decay< Fn >::type fn = std::forward< Fn >( std::get< 0 >( * p) );
|
|
t.data = & std::get< 1 >( * p);
|
|
Ctx c{ t };
|
|
// execute function, pass continuation via reference
|
|
- std::get< 1 >( * p) = detail::helper< sizeof ... (Arg) >::convert( fn( std::move( c) ) );
|
|
+ typedef typename std::decay<decltype(std::get<1>(*p))>::type H;
|
|
+ std::get< 1 >(* p) = detail::helper<H>::convert( fn( std::move( c) ) );
|
|
#if defined(BOOST_NO_CXX14_STD_EXCHANGE)
|
|
return { detail::exchange( c.t_.fctx, nullptr), & std::get< 1 >( * p) };
|
|
#else
|
|
@@ -275,7 +276,7 @@
|
|
template< typename Ctx, typename StackAlloc, typename Fn >
|
|
friend class detail::record;
|
|
|
|
- template< typename Ctx, typename Fn, typename ... Arg >
|
|
+ template< typename Ctx, typename Fn, typename Arg >
|
|
friend detail::transfer_t
|
|
context_ontop( detail::transfer_t);
|
|
|
|
@@ -354,7 +355,7 @@
|
|
template< typename Fn, typename ... Arg >
|
|
continuation resume_with( Fn && fn, Arg ... arg) {
|
|
BOOST_ASSERT( nullptr != t_.fctx);
|
|
- auto tpl = std::make_tuple( std::forward< Fn >( fn), std::forward< Arg >( arg) ... );
|
|
+ auto tpl = std::make_tuple( std::forward< Fn >( fn), std::make_tuple( std::forward< Arg >( arg) ... ));
|
|
return detail::ontop_fcontext(
|
|
#if defined(BOOST_NO_CXX14_STD_EXCHANGE)
|
|
detail::exchange( t_.fctx, nullptr),
|
|
@@ -362,7 +363,7 @@
|
|
std::exchange( t_.fctx, nullptr),
|
|
#endif
|
|
& tpl,
|
|
- context_ontop< continuation, Fn, Arg ... >);
|
|
+ context_ontop< continuation, Fn, decltype(tpl) >);
|
|
}
|
|
|
|
continuation resume() {
|
|
@@ -451,7 +452,8 @@
|
|
template<
|
|
typename Fn,
|
|
typename ... Arg,
|
|
- typename = detail::disable_overload< continuation, Fn >
|
|
+ typename = detail::disable_overload< continuation, Fn >,
|
|
+ typename = detail::disable_overload< std::allocator_arg_t, Fn >
|
|
>
|
|
continuation
|
|
callcc( Fn && fn, Arg ... arg) {
|