From 93dc9876a0565678a81a4295f59bc20e36b70c64 Mon Sep 17 00:00:00 2001 From: Yedidya Feldblum Date: Thu, 20 Jul 2017 15:10:41 -0700 Subject: [PATCH] Drop a remnant of gcc48 support in futures Summary: [Folly] Drop a remnant of gcc48 support in futures. Because gcc48 is no longer supported. Reviewed By: Orvid, meyering Differential Revision: D5460788 fbshipit-source-id: 86e2985a0980357641d18f59fd25b9667ec30ab0 --- folly/futures/Future-pre.h | 19 ------------------- folly/futures/Future.h | 15 ++------------- 2 files changed, 2 insertions(+), 32 deletions(-) diff --git a/folly/futures/Future-pre.h b/folly/futures/Future-pre.h index 09fa0667..3eb9056e 100644 --- a/folly/futures/Future-pre.h +++ b/folly/futures/Future-pre.h @@ -136,25 +136,6 @@ struct Extract { typedef typename ArgType::FirstArg FirstArg; }; -// gcc-4.8 refuses to capture a function reference in a lambda. This can be -// mitigated by casting them to function pointer types first. The following -// helper is used in Future.h to achieve that where necessary. -// When compiling with gcc versions 4.9 and up, as well as clang, we do not -// need to apply FunctionReferenceToPointer (i.e. T can be used instead of -// FunctionReferenceToPointer). -// Applying FunctionReferenceToPointer first, the code works on all tested -// compiler versions: gcc 4.8 and above, cland 3.5 and above. - -template -struct FunctionReferenceToPointer { - using type = T; -}; - -template -struct FunctionReferenceToPointer { - using type = R (*)(Args...); -}; - } // namespace detail } // namespace futures diff --git a/folly/futures/Future.h b/folly/futures/Future.h index 56f24483..919b2391 100644 --- a/folly/futures/Future.h +++ b/folly/futures/Future.h @@ -202,20 +202,9 @@ class Future { value(), which may rethrow if this has captured an exception. If func throws, the exception will be captured in the Future that is returned. */ - // gcc 4.8 requires that we cast function reference types to function pointer - // types. Fore more details see the comment on FunctionReferenceToPointer - // in Future-pre.h. - // gcc versions 4.9 and above (as well as clang) do not require this hack. - // For those, the FF tenplate parameter can be removed and occurences of FF - // replaced with F. - template < - typename F, - typename FF = - typename futures::detail::FunctionReferenceToPointer::type, - typename R = futures::detail::callableResult> + template > typename R::Return then(F&& func) { - typedef typename R::Arg Arguments; - return thenImplementation(std::forward(func), Arguments()); + return thenImplementation(std::forward(func), typename R::Arg()); } /// Variant where func is an member function -- 2.34.1