From 2aed11df4091a87c6c3141bca78a480e2759d2ae Mon Sep 17 00:00:00 2001 From: Hans Fugal Date: Wed, 22 Apr 2015 16:32:22 -0700 Subject: [PATCH] Cleanup Future(Value) ctor Summary: We don't need to check for void after all, and with perfect forwarding we don't need separate const& and && versions. Test Plan: tests still pass Reviewed By: jsedgwick@fb.com Subscribers: exa, folly-diffs@, jsedgwick, yfeldblum, chalfant FB internal diff: D2014264 Tasks: 6847876 Signature: t1:2014264:1429735036:01ac166399ef8d0f2f34adb51e965809022c2b64 --- folly/futures/Future-inl.h | 20 ++++---------------- folly/futures/Future.h | 9 ++------- 2 files changed, 6 insertions(+), 23 deletions(-) diff --git a/folly/futures/Future-inl.h b/folly/futures/Future-inl.h index a4ec35f0..5604ed06 100644 --- a/folly/futures/Future-inl.h +++ b/folly/futures/Future-inl.h @@ -44,22 +44,10 @@ Future& Future::operator=(Future&& other) noexcept { } template -template -Future::Future( - const typename std::enable_if::value, F>::type& val) - : core_(nullptr) { - Promise p; - p.setValue(val); - *this = p.getFuture(); -} - -template -template -Future::Future( - typename std::enable_if::value, F>::type&& val) - : core_(nullptr) { - Promise p; - p.setValue(std::forward(val)); +template +Future::Future(T2&& val) : core_(nullptr) { + Promise p; + p.setValue(std::forward(val)); *this = p.getFuture(); } diff --git a/folly/futures/Future.h b/folly/futures/Future.h index a14d62cf..8e2b3f1e 100644 --- a/folly/futures/Future.h +++ b/folly/futures/Future.h @@ -213,14 +213,9 @@ class Future { Future(Future&&) noexcept; Future& operator=(Future&&) noexcept; - // makeFuture - template - /* implicit */ - Future(const typename std::enable_if::value, F>::type& val); - - template + /// Construct a Future from a value (perfect forwarding) /* implicit */ - Future(typename std::enable_if::value, F>::type&& val); + template Future(T2&& val); template ::value, int>::type = 0> -- 2.34.1