Commit 5b531cbb authored by Hans Fugal's avatar Hans Fugal Committed by Praveen Kumar Ramakrishnan

Do not construct a Future<T> from a Future<Something> value

Summary: The value constructor can be nice. But when it matches on Future<Something> 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
parent e4c703f0
......@@ -44,7 +44,8 @@ Future<T>& Future<T>::operator=(Future<T>&& other) noexcept {
}
template <class T>
template <class T2>
template <class T2,
typename std::enable_if<!isFuture<T2>::value, void*>::type>
Future<T>::Future(T2&& val) : core_(nullptr) {
Promise<T> p;
p.setValue(std::forward<T2>(val));
......
......@@ -56,7 +56,9 @@ class Future {
/// Construct a Future from a value (perfect forwarding)
/* implicit */
template <class T2 = T> Future(T2&& val);
template <class T2 = T,
typename std::enable_if<!isFuture<T2>::value, void*>::type = nullptr>
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