You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
3.0 KiB

  1. Index: boost_1_64_0/boost/context/continuation.hpp
  2. ===================================================================
  3. --- boost_1_64_0.orig/boost/context/continuation.hpp 2017-04-24 12:36:55.987412031 +0100
  4. +++ boost_1_64_0/boost/context/continuation.hpp 2017-04-24 12:37:49.730416122 +0100
  5. @@ -56,7 +56,7 @@
  6. namespace context {
  7. namespace detail {
  8. -template< int N >
  9. +template<typename U>
  10. struct helper {
  11. template< typename T >
  12. static T convert( T && t) noexcept {
  13. @@ -64,8 +64,8 @@
  14. }
  15. };
  16. -template<>
  17. -struct helper< 1 > {
  18. +template<typename U>
  19. +struct helper< std::tuple<U> > {
  20. template< typename T >
  21. static std::tuple< T > convert( T && t) noexcept {
  22. return std::make_tuple( std::forward< T >( t) );
  23. @@ -239,15 +239,16 @@
  24. }
  25. -template< typename Ctx, typename Fn, typename ... Arg >
  26. +template< typename Ctx, typename Fn, typename Arg >
  27. detail::transfer_t context_ontop( detail::transfer_t t) {
  28. - auto p = static_cast< std::tuple< Fn, std::tuple< Arg ... > > * >( t.data);
  29. + auto p = static_cast< Arg * >( t.data);
  30. BOOST_ASSERT( nullptr != p);
  31. typename std::decay< Fn >::type fn = std::forward< Fn >( std::get< 0 >( * p) );
  32. t.data = & std::get< 1 >( * p);
  33. Ctx c{ t };
  34. // execute function, pass continuation via reference
  35. - std::get< 1 >( * p) = detail::helper< sizeof ... (Arg) >::convert( fn( std::move( c) ) );
  36. + typedef typename std::decay<decltype(std::get<1>(*p))>::type H;
  37. + std::get< 1 >(* p) = detail::helper<H>::convert( fn( std::move( c) ) );
  38. #if defined(BOOST_NO_CXX14_STD_EXCHANGE)
  39. return { detail::exchange( c.t_.fctx, nullptr), & std::get< 1 >( * p) };
  40. #else
  41. @@ -275,7 +276,7 @@
  42. template< typename Ctx, typename StackAlloc, typename Fn >
  43. friend class detail::record;
  44. - template< typename Ctx, typename Fn, typename ... Arg >
  45. + template< typename Ctx, typename Fn, typename Arg >
  46. friend detail::transfer_t
  47. context_ontop( detail::transfer_t);
  48. @@ -354,7 +355,7 @@
  49. template< typename Fn, typename ... Arg >
  50. continuation resume_with( Fn && fn, Arg ... arg) {
  51. BOOST_ASSERT( nullptr != t_.fctx);
  52. - auto tpl = std::make_tuple( std::forward< Fn >( fn), std::forward< Arg >( arg) ... );
  53. + auto tpl = std::make_tuple( std::forward< Fn >( fn), std::make_tuple( std::forward< Arg >( arg) ... ));
  54. return detail::ontop_fcontext(
  55. #if defined(BOOST_NO_CXX14_STD_EXCHANGE)
  56. detail::exchange( t_.fctx, nullptr),
  57. @@ -362,7 +363,7 @@
  58. std::exchange( t_.fctx, nullptr),
  59. #endif
  60. & tpl,
  61. - context_ontop< continuation, Fn, Arg ... >);
  62. + context_ontop< continuation, Fn, decltype(tpl) >);
  63. }
  64. continuation resume() {
  65. @@ -451,7 +452,8 @@
  66. template<
  67. typename Fn,
  68. typename ... Arg,
  69. - typename = detail::disable_overload< continuation, Fn >
  70. + typename = detail::disable_overload< continuation, Fn >,
  71. + typename = detail::disable_overload< std::allocator_arg_t, Fn >
  72. >
  73. continuation
  74. callcc( Fn && fn, Arg ... arg) {