From 5b531cbb45884ad8a27891cf3170cd0286c3183c Mon Sep 17 00:00:00 2001 From: Hans Fugal Date: Thu, 30 Apr 2015 15:09:05 -0700 Subject: [PATCH] Do not construct a Future from a Future value Summary: The value constructor can be nice. But when it matches on Future it just confuses everybody. Test Plan: building and running tests contbuild Reviewed By: jsedgwick@fb.com Subscribers: exa, folly-diffs@, jsedgwick, yfeldblum, chalfant FB internal diff: D2036455 Tasks: 6925951 Signature: t1:2036455:1430423503:73906f748318c4ebec13f45ad3761f104e2ef888 --- folly/futures/Future-inl.h | 3 ++- folly/futures/Future.h | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/folly/futures/Future-inl.h b/folly/futures/Future-inl.h index f6abe7b4..927a3142 100644 --- a/folly/futures/Future-inl.h +++ b/folly/futures/Future-inl.h @@ -44,7 +44,8 @@ Future& Future::operator=(Future&& other) noexcept { } template -template +template ::value, void*>::type> Future::Future(T2&& val) : core_(nullptr) { Promise p; p.setValue(std::forward(val)); diff --git a/folly/futures/Future.h b/folly/futures/Future.h index cc0bd36a..06572c63 100644 --- a/folly/futures/Future.h +++ b/folly/futures/Future.h @@ -56,7 +56,9 @@ class Future { /// Construct a Future from a value (perfect forwarding) /* implicit */ - template Future(T2&& val); + template ::value, void*>::type = nullptr> + Future(T2&& val); template