Commit 97d612a3 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Prefer lift_unit_t in lift_unit call-sites

Summary:
[Folly] Prefer `lift_unit_t<T>` in `lift_unit` call-sites over `typename lift_unit<T>::type`.

(Note: this ignores all push blocking failures!)

Reviewed By: andriigrynenko

Differential Revision: D13410680

fbshipit-source-id: e51f16d31fc30bd2858f89a2b90271525f17706e
parent 2df6e3b0
...@@ -65,9 +65,9 @@ class FutureExecutor : public ExecutorImpl { ...@@ -65,9 +65,9 @@ class FutureExecutor : public ExecutorImpl {
template <typename F> template <typename F>
typename std::enable_if< typename std::enable_if<
!folly::isFuture<invoke_result_t<F>>::value, !folly::isFuture<invoke_result_t<F>>::value,
folly::Future<typename folly::lift_unit<invoke_result_t<F>>::type>>::type folly::Future<folly::lift_unit_t<invoke_result_t<F>>>>::type
addFuture(F func) { addFuture(F func) {
using T = typename folly::lift_unit<invoke_result_t<F>>::type; using T = folly::lift_unit_t<invoke_result_t<F>>;
folly::Promise<T> promise; folly::Promise<T> promise;
auto future = promise.getFuture(); auto future = promise.getFuture();
ExecutorImpl::add( ExecutorImpl::add(
......
...@@ -23,9 +23,9 @@ namespace fibers { ...@@ -23,9 +23,9 @@ namespace fibers {
template <typename F> template <typename F>
auto FiberManager::addTaskFuture(F&& func) auto FiberManager::addTaskFuture(F&& func)
-> folly::Future<typename folly::lift_unit<invoke_result_t<F>>::type> { -> folly::Future<folly::lift_unit_t<invoke_result_t<F>>> {
using T = invoke_result_t<F>; using T = invoke_result_t<F>;
using FutureT = typename folly::lift_unit<T>::type; using FutureT = folly::lift_unit_t<T>;
folly::Promise<FutureT> p; folly::Promise<FutureT> p;
auto f = p.getFuture(); auto f = p.getFuture();
...@@ -39,8 +39,8 @@ auto FiberManager::addTaskFuture(F&& func) ...@@ -39,8 +39,8 @@ auto FiberManager::addTaskFuture(F&& func)
template <typename F> template <typename F>
auto FiberManager::addTaskRemoteFuture(F&& func) auto FiberManager::addTaskRemoteFuture(F&& func)
-> folly::Future<typename folly::lift_unit<invoke_result_t<F>>::type> { -> folly::Future<folly::lift_unit_t<invoke_result_t<F>>> {
folly::Promise<typename folly::lift_unit<invoke_result_t<F>>::type> p; folly::Promise<folly::lift_unit_t<invoke_result_t<F>>> p;
auto f = p.getFuture(); auto f = p.getFuture();
addTaskRemote( addTaskRemote(
[p = std::move(p), func = std::forward<F>(func), this]() mutable { [p = std::move(p), func = std::forward<F>(func), this]() mutable {
......
...@@ -214,7 +214,7 @@ class FiberManager : public ::folly::Executor { ...@@ -214,7 +214,7 @@ class FiberManager : public ::folly::Executor {
*/ */
template <typename F> template <typename F>
auto addTaskFuture(F&& func) auto addTaskFuture(F&& func)
-> folly::Future<typename folly::lift_unit<invoke_result_t<F>>::type>; -> folly::Future<folly::lift_unit_t<invoke_result_t<F>>>;
/** /**
* Add a new task to be executed. Safe to call from other threads. * Add a new task to be executed. Safe to call from other threads.
* *
...@@ -233,7 +233,7 @@ class FiberManager : public ::folly::Executor { ...@@ -233,7 +233,7 @@ class FiberManager : public ::folly::Executor {
*/ */
template <typename F> template <typename F>
auto addTaskRemoteFuture(F&& func) auto addTaskRemoteFuture(F&& func)
-> folly::Future<typename folly::lift_unit<invoke_result_t<F>>::type>; -> folly::Future<folly::lift_unit_t<invoke_result_t<F>>>;
// Executor interface calls addTaskRemote // Executor interface calls addTaskRemote
void add(folly::Func f) override { void add(folly::Func f) override {
......
...@@ -27,7 +27,7 @@ class SemiFuture; ...@@ -27,7 +27,7 @@ class SemiFuture;
template <typename T> template <typename T>
struct isSemiFuture : std::false_type { struct isSemiFuture : std::false_type {
using Inner = typename lift_unit<T>::type; using Inner = lift_unit_t<T>;
}; };
template <typename T> template <typename T>
...@@ -37,7 +37,7 @@ struct isSemiFuture<SemiFuture<T>> : std::true_type { ...@@ -37,7 +37,7 @@ struct isSemiFuture<SemiFuture<T>> : std::true_type {
template <typename T> template <typename T>
struct isFuture : std::false_type { struct isFuture : std::false_type {
using Inner = typename lift_unit<T>::type; using Inner = lift_unit_t<T>;
}; };
template <typename T> template <typename T>
...@@ -47,7 +47,7 @@ struct isFuture<Future<T>> : std::true_type { ...@@ -47,7 +47,7 @@ struct isFuture<Future<T>> : std::true_type {
template <typename T> template <typename T>
struct isFutureOrSemiFuture : std::false_type { struct isFutureOrSemiFuture : std::false_type {
using Inner = typename lift_unit<T>::type; using Inner = lift_unit_t<T>;
using Return = Inner; using Return = Inner;
}; };
......
...@@ -180,7 +180,7 @@ makeSemiFutureWith(F&& func); ...@@ -180,7 +180,7 @@ makeSemiFutureWith(F&& func);
template <class F> template <class F>
typename std::enable_if< typename std::enable_if<
!(isFutureOrSemiFuture<invoke_result_t<F>>::value), !(isFutureOrSemiFuture<invoke_result_t<F>>::value),
SemiFuture<typename lift_unit<invoke_result_t<F>>::type>>::type SemiFuture<lift_unit_t<invoke_result_t<F>>>>::type
makeSemiFutureWith(F&& func); makeSemiFutureWith(F&& func);
/// Make a failed Future from an exception_ptr. /// Make a failed Future from an exception_ptr.
...@@ -264,7 +264,7 @@ typename std:: ...@@ -264,7 +264,7 @@ typename std::
template <class F> template <class F>
typename std::enable_if< typename std::enable_if<
!(isFuture<invoke_result_t<F>>::value), !(isFuture<invoke_result_t<F>>::value),
Future<typename lift_unit<invoke_result_t<F>>::type>>::type Future<lift_unit_t<invoke_result_t<F>>>>::type
makeFutureWith(F&& func); makeFutureWith(F&& func);
/// Make a failed Future from an exception_ptr. /// Make a failed Future from an exception_ptr.
......
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