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