From bd88147589d710ee103da18466f94c45dc52b709 Mon Sep 17 00:00:00 2001 From: Oliver Kowalke Date: Sun, 13 Dec 2015 17:11:23 +0100 Subject: [PATCH] exclude packaged_task ctor form overload resolution --- include/boost/fiber/future/packaged_task.hpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/include/boost/fiber/future/packaged_task.hpp b/include/boost/fiber/future/packaged_task.hpp index f391477f..42f5453f 100644 --- a/include/boost/fiber/future/packaged_task.hpp +++ b/include/boost/fiber/future/packaged_task.hpp @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -28,6 +29,7 @@ class packaged_task; template< typename R, typename ... Args > class packaged_task< R( Args ... ) > { private: + typedef packaged_task< R( Args ... ) > self_t; typedef typename detail::task_base< R, Args ... >::ptr_t ptr_t; bool obtained_{ false }; @@ -36,14 +38,28 @@ private: public: constexpr packaged_task() noexcept = default; - template< typename Fn > + template< typename Fn, + class = typename std::enable_if< + ! std::is_same< + typename std::decay< Fn >::type, + self_t + >::value + >::type + > explicit packaged_task( Fn && fn) : packaged_task{ std::allocator_arg, std::allocator< packaged_task >{}, std::forward< Fn >( fn) } { } - template< typename Fn, typename Allocator > + template< typename Fn, typename Allocator, + class = typename std::enable_if< + ! std::is_same< + typename std::decay< Fn >::type, + self_t + >::value + >::type + > explicit packaged_task( std::allocator_arg_t, Allocator const& alloc, Fn && fn) { typedef detail::task_object< typename std::decay< Fn >::type, Allocator, R, Args ...