makeFuture(Try<T>&&)
authorJames Sedgwick <jsedgwick@fb.com>
Fri, 9 May 2014 22:37:42 +0000 (15:37 -0700)
committerDave Watson <davejwatson@fb.com>
Tue, 20 May 2014 19:53:58 +0000 (12:53 -0700)
commit74ff76d8eafb6cd2d1d82d2d9061788f14e3c6f2
treeb03307f33b4ac9fcfe69786d63cad94696729ecb
parent714d6c807fe6602745495f11e206e472db69a955
makeFuture(Try<T>&&)

Summary:
@override-unit-failures
Add makeFuture variant which extracts the result contained in a Try and sticks it in a Future
One use case:

```
template <typename Result, typename Op, typename... Args>
Future<Result> wrapper(Op op, Args&&... args) {
// ... do some stuff before...
return op(std::forward<Args>(args)...).then([] (Try<Result>&& t) {
// ... do some stuff after...
return makeFuture<Result>(std::move(t));
});
}
```

With this makeFuture variant, "wrapper" doesn't need to be specialized for when
Result is void

Test Plan: employed in my code, will link to diff when ready

Reviewed By: hans@fb.com

FB internal diff: D1318047
folly/wangle/Future-inl.h
folly/wangle/Future.h