On 9/4/2015 2:50 PM, Oliver Kowalke wrote:
2015-09-04 19:28 GMT+02:00 Agustín K-ballo Bergé
: Nod, just like my analysis above says. So would you be willing to take patches for C++11 support?
if the code remains readable, yes
Supporting `index_sequence` is easy, that's a library feature that can be implemented in C++11. The implementation I linked earlier is even better at compile times than some of those shipped by standard library implementations (but not as good as it could be).
I encountered that emulating move capture is not trivial, but maybe you have a nifty solution
Emulating move capture is not that simple, consider this initial implementation: [=,fn=std::forward< Fn >( fn),tpl=std::make_tuple( std::forward< Args >( args) ...)] () mutable -> decltype( auto) { try { BOOST_ASSERT( is_running() ); detail::invoke_helper( std::move( fn), std::move( tpl) ); BOOST_ASSERT( is_running() ); } catch( fiber_interrupted const&) { except_ = std::current_exception(); } catch( ... ) { std::terminate(); } }); A C++11 compatible one would instead do: std::bind([]( typename std::decay<Fn>::type& fn, decltype(std::make_tuple( std::forward< Args >( args)))& tpl ) -> void { try { BOOST_ASSERT( is_running() ); detail::invoke_helper( std::move( fn), std::move( tpl) ); BOOST_ASSERT( is_running() ); } catch( fiber_interrupted const&) { except_ = std::current_exception(); } catch( ... ) { std::terminate(); } }, std::forward< Fn >( fn), std::make_tuple( std::forward< Args >( args) ...)); // I assume there's a `this` involved here as well Incidentally, try to avoid using `auto/decltype(auto)` on function templates (specially when the return type is as simple as `void`), as instantiation is required for them even for innocuous things like using `decltype` on them. Regards, -- Agustín K-ballo Bergé.- http://talesofcpp.fusionfenix.com