Add conversion constructors for Future
Summary:previously we were not able to do
Future<Base> f = makeFuture<Derived>();
This is because Future did not declare a conversion
constructor.
Adding a proper conversion ctor for Future is very
tricky because of the way Core is managed under the hood.
Core is not movable, and cannot be moved otherwise we
would have to retain pointers to the Future and Promises which
pointed to a particular core. This would be inefficient.
Instead we compromise and allow a very small subset of conversions
from objects whose templated types are convertible and also the
sizes of their Cores are also the same. As a result, we can
convert between types like unique_ptrs however not always between
full objects.
Reviewed By: jsedgwick
Differential Revision:
D2943775
fb-gh-sync-id:
7c2388f2fb49d789c80ae2477814e960a099771b
shipit-source-id:
7c2388f2fb49d789c80ae2477814e960a099771b