summaryrefslogtreecommitdiff
path: root/boost/fiber/fiber.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/fiber/fiber.hpp')
-rw-r--r--boost/fiber/fiber.hpp47
1 files changed, 33 insertions, 14 deletions
diff --git a/boost/fiber/fiber.hpp b/boost/fiber/fiber.hpp
index 1508a9b5a6..eb10487c66 100644
--- a/boost/fiber/fiber.hpp
+++ b/boost/fiber/fiber.hpp
@@ -15,6 +15,7 @@
#include <boost/assert.hpp>
#include <boost/config.hpp>
#include <boost/intrusive_ptr.hpp>
+#include <boost/predef.h>
#include <boost/fiber/detail/config.hpp>
#include <boost/fiber/detail/disable_overload.hpp>
@@ -52,41 +53,59 @@ public:
fiber() = default;
template< typename Fn,
- typename ... Args,
- typename = detail::disable_overload< fiber, Fn >
+ typename ... Arg,
+ typename = detail::disable_overload< fiber, Fn >,
+ typename = detail::disable_overload< launch, Fn >,
+ typename = detail::disable_overload< std::allocator_arg_t, Fn >
>
- fiber( Fn && fn, Args && ... args) :
+#if BOOST_COMP_GNUC < 50000000
+ fiber( Fn && fn, Arg && ... arg) :
+#else
+ fiber( Fn && fn, Arg ... arg) :
+#endif
fiber{ launch::post,
std::allocator_arg, default_stack(),
- std::forward< Fn >( fn), std::forward< Args >( args) ... } {
+ std::forward< Fn >( fn), std::forward< Arg >( arg) ... } {
}
template< typename Fn,
- typename ... Args,
+ typename ... Arg,
typename = detail::disable_overload< fiber, Fn >
>
- fiber( launch policy, Fn && fn, Args && ... args) :
+#if BOOST_COMP_GNUC < 50000000
+ fiber( launch policy, Fn && fn, Arg && ... arg) :
+#else
+ fiber( launch policy, Fn && fn, Arg ... arg) :
+#endif
fiber{ policy,
std::allocator_arg, default_stack(),
- std::forward< Fn >( fn), std::forward< Args >( args) ... } {
+ std::forward< Fn >( fn), std::forward< Arg >( arg) ... } {
}
template< typename StackAllocator,
typename Fn,
- typename ... Args
+ typename ... Arg
>
- fiber( std::allocator_arg_t, StackAllocator salloc, Fn && fn, Args && ... args) :
+#if BOOST_COMP_GNUC < 50000000
+ fiber( std::allocator_arg_t, StackAllocator salloc, Fn && fn, Arg && ... arg) :
+#else
+ fiber( std::allocator_arg_t, StackAllocator salloc, Fn && fn, Arg ... arg) :
+#endif
fiber{ launch::post,
std::allocator_arg, salloc,
- std::forward< Fn >( fn), std::forward< Args >( args) ... } {
+ std::forward< Fn >( fn), std::forward< Arg >( arg) ... } {
}
template< typename StackAllocator,
typename Fn,
- typename ... Args
+ typename ... Arg
>
- fiber( launch policy, std::allocator_arg_t, StackAllocator salloc, Fn && fn, Args && ... args) :
- impl_{ make_worker_context( policy, salloc, std::forward< Fn >( fn), std::forward< Args >( args) ... ) } {
+#if BOOST_COMP_GNUC < 50000000
+ fiber( launch policy, std::allocator_arg_t, StackAllocator salloc, Fn && fn, Arg && ... arg) :
+#else
+ fiber( launch policy, std::allocator_arg_t, StackAllocator salloc, Fn && fn, Arg ... arg) :
+#endif
+ impl_{ make_worker_context( policy, salloc, std::forward< Fn >( fn), std::forward< Arg >( arg) ... ) } {
start_();
}
@@ -108,7 +127,7 @@ public:
if ( joinable() ) {
std::terminate();
}
- if ( this == & other) {
+ if ( BOOST_UNLIKELY( this == & other) ) {
return * this;
}
impl_.swap( other.impl_);