noddos: Noddos v0.5.0 with mDNS / DNS-SD support
[feed/packages.git] / libs / boost / patches / 02_fix_context_overload_ambiguity.patch
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
9 -template< int N >
10 +template<typename U>
11 struct helper {
12 template< typename T >
13 static T convert( T && t) noexcept {
14 @@ -64,8 +64,8 @@
15 }
16 };
17
18 -template<>
19 -struct helper< 1 > {
20 +template<typename U>
21 +struct helper< std::tuple<U> > {
22 template< typename T >
23 static std::tuple< T > convert( T && t) noexcept {
24 return std::make_tuple( std::forward< T >( t) );
25 @@ -239,15 +239,16 @@
26
27 }
28
29 -template< typename Ctx, typename Fn, typename ... Arg >
30 +template< typename Ctx, typename Fn, typename Arg >
31 detail::transfer_t context_ontop( detail::transfer_t t) {
32 - auto p = static_cast< std::tuple< Fn, std::tuple< Arg ... > > * >( t.data);
33 + auto p = static_cast< Arg * >( t.data);
34 BOOST_ASSERT( nullptr != p);
35 typename std::decay< Fn >::type fn = std::forward< Fn >( std::get< 0 >( * p) );
36 t.data = & std::get< 1 >( * p);
37 Ctx c{ t };
38 // execute function, pass continuation via reference
39 - std::get< 1 >( * p) = detail::helper< sizeof ... (Arg) >::convert( fn( std::move( c) ) );
40 + typedef typename std::decay<decltype(std::get<1>(*p))>::type H;
41 + std::get< 1 >(* p) = detail::helper<H>::convert( fn( std::move( c) ) );
42 #if defined(BOOST_NO_CXX14_STD_EXCHANGE)
43 return { detail::exchange( c.t_.fctx, nullptr), & std::get< 1 >( * p) };
44 #else
45 @@ -275,7 +276,7 @@
46 template< typename Ctx, typename StackAlloc, typename Fn >
47 friend class detail::record;
48
49 - template< typename Ctx, typename Fn, typename ... Arg >
50 + template< typename Ctx, typename Fn, typename Arg >
51 friend detail::transfer_t
52 context_ontop( detail::transfer_t);
53
54 @@ -354,7 +355,7 @@
55 template< typename Fn, typename ... Arg >
56 continuation resume_with( Fn && fn, Arg ... arg) {
57 BOOST_ASSERT( nullptr != t_.fctx);
58 - auto tpl = std::make_tuple( std::forward< Fn >( fn), std::forward< Arg >( arg) ... );
59 + auto tpl = std::make_tuple( std::forward< Fn >( fn), std::make_tuple( std::forward< Arg >( arg) ... ));
60 return detail::ontop_fcontext(
61 #if defined(BOOST_NO_CXX14_STD_EXCHANGE)
62 detail::exchange( t_.fctx, nullptr),
63 @@ -362,7 +363,7 @@
64 std::exchange( t_.fctx, nullptr),
65 #endif
66 & tpl,
67 - context_ontop< continuation, Fn, Arg ... >);
68 + context_ontop< continuation, Fn, decltype(tpl) >);
69 }
70
71 continuation resume() {
72 @@ -451,7 +452,8 @@
73 template<
74 typename Fn,
75 typename ... Arg,
76 - typename = detail::disable_overload< continuation, Fn >
77 + typename = detail::disable_overload< continuation, Fn >,
78 + typename = detail::disable_overload< std::allocator_arg_t, Fn >
79 >
80 continuation
81 callcc( Fn && fn, Arg ... arg) {