Commit f639b454 authored by James Sedgwick's avatar James Sedgwick Committed by Viswanath Sivakumar

more restrictive implicit Future construction enabling

Summary:
Decay so we don't try to instantiate this for attempts to copy Futures
See https://www.facebook.com/groups/499316706783616/permalink/863260220389261/

Test Plan: unit

Reviewed By: hans@fb.com

Subscribers: hannesr, folly-diffs@, jsedgwick, yfeldblum, chalfant

FB internal diff: D2062442

Signature: t1:2062442:1431551169:d1ba61537c998067ee7e6f4819f7e0817cc2e700
parent 62dbf939
...@@ -44,8 +44,7 @@ Future<T>& Future<T>::operator=(Future<T>&& other) noexcept { ...@@ -44,8 +44,7 @@ Future<T>& Future<T>::operator=(Future<T>&& other) noexcept {
} }
template <class T> template <class T>
template <class T2, template <class T2, typename>
typename std::enable_if<!isFuture<T2>::value, void*>::type>
Future<T>::Future(T2&& val) : core_(nullptr) { Future<T>::Future(T2&& val) : core_(nullptr) {
Promise<T> p; Promise<T> p;
p.setValue(std::forward<T2>(val)); p.setValue(std::forward<T2>(val));
......
...@@ -55,10 +55,10 @@ class Future { ...@@ -55,10 +55,10 @@ class Future {
Future& operator=(Future&&) noexcept; Future& operator=(Future&&) noexcept;
/// Construct a Future from a value (perfect forwarding) /// Construct a Future from a value (perfect forwarding)
/* implicit */ template <class T2 = T, typename =
template <class T2 = T, typename std::enable_if<
typename std::enable_if<!isFuture<T2>::value, void*>::type = nullptr> !isFuture<typename std::decay<T2>::type>::value>::type>
Future(T2&& val); /* implicit */ Future(T2&& val);
template <class T2 = T, template <class T2 = T,
typename std::enable_if< typename std::enable_if<
......
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