X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=blobdiff_plain;f=folly%2Ffutures%2FFuture-inl.h;h=4089a67647ca1ea893f2d8c2fc32120c2696d0a9;hp=c4f9ca2f307ab6b49e6c1286f1947346d72867f4;hb=8401bbaffc06e05b14ea7057842b7ed2804375c0;hpb=ba9034b9647da166a87ef42583415fbcc8127255 diff --git a/folly/futures/Future-inl.h b/folly/futures/Future-inl.h index c4f9ca2f..4089a676 100644 --- a/folly/futures/Future-inl.h +++ b/folly/futures/Future-inl.h @@ -324,7 +324,7 @@ template template Future Future::ensure(F&& func) { return this->then([funcw = std::forward(func)](Try && t) mutable { - funcw(); + std::move(funcw)(); return makeFuture(std::move(t)); }); } @@ -333,7 +333,7 @@ template template Future Future::onTimeout(Duration dur, F&& func, Timekeeper* tk) { return within(dur, tk).onError([funcw = std::forward(func)]( - TimedOut const&) { return funcw(); }); + TimedOut const&) { return std::move(funcw)(); }); } template @@ -457,8 +457,7 @@ inline Future Future::via(Executor* executor, int8_t priority) & { template auto via(Executor* x, Func&& func) - -> Future::Inner> -{ + -> Future()())>::Inner> { // TODO make this actually more performant. :-P #7260175 return via(x).then(std::forward(func)); } @@ -504,7 +503,7 @@ makeFutureWith(F&& func) { using InnerType = typename isFuture::type>::Inner; try { - return func(); + return std::forward(func)(); } catch (std::exception& e) { return makeFuture( exception_wrapper(std::current_exception(), e)); @@ -522,9 +521,8 @@ typename std::enable_if< makeFutureWith(F&& func) { using LiftedResult = typename Unit::Lift::type>::type; - return makeFuture(makeTryWith([&func]() mutable { - return func(); - })); + return makeFuture( + makeTryWith([&func]() mutable { return std::forward(func)(); })); } template @@ -574,7 +572,7 @@ collectAll(Fs&&... fs) { auto ctx = std::make_shared::type::value_type...>>(); detail::collectVariadicHelper( - ctx, std::forward::type>(fs)...); + ctx, std::forward(fs)...); return ctx->p.getFuture(); } @@ -677,7 +675,7 @@ collect(Fs&&... fs) { auto ctx = std::make_shared::type::value_type...>>(); detail::collectVariadicHelper( - ctx, std::forward::type>(fs)...); + ctx, std::forward(fs)...); return ctx->p.getFuture(); }