Commit 93dc9876 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

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
parent 663e27f9
...@@ -136,25 +136,6 @@ struct Extract<R (&)(Args...)> { ...@@ -136,25 +136,6 @@ struct Extract<R (&)(Args...)> {
typedef typename ArgType<Args...>::FirstArg FirstArg; typedef typename ArgType<Args...>::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<T>).
// Applying FunctionReferenceToPointer first, the code works on all tested
// compiler versions: gcc 4.8 and above, cland 3.5 and above.
template <typename T>
struct FunctionReferenceToPointer {
using type = T;
};
template <typename R, typename... Args>
struct FunctionReferenceToPointer<R (&)(Args...)> {
using type = R (*)(Args...);
};
} // namespace detail } // namespace detail
} // namespace futures } // namespace futures
......
...@@ -202,20 +202,9 @@ class Future { ...@@ -202,20 +202,9 @@ class Future {
value(), which may rethrow if this has captured an exception. If func value(), which may rethrow if this has captured an exception. If func
throws, the exception will be captured in the Future that is returned. 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 template <typename F, typename R = futures::detail::callableResult<T, F>>
// 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<F>::type,
typename R = futures::detail::callableResult<T, FF>>
typename R::Return then(F&& func) { typename R::Return then(F&& func) {
typedef typename R::Arg Arguments; return thenImplementation<F, R>(std::forward<F>(func), typename R::Arg());
return thenImplementation<FF, R>(std::forward<FF>(func), Arguments());
} }
/// Variant where func is an member function /// Variant where func is an member function
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment