Commit ee3a3a1e authored by László Várady's avatar László Várady Committed by Facebook Github Bot

Remove std::move() calls that prevent NRVO (#1217)

Summary:
> Under the following circumstances, the compilers are permitted to omit the copy and move construction of class objects:

> In a return statement, when the operand is the name of a non-volatile object with automatic storage duration, which isn't a function parameter or a catch clause parameter, and which is of the same class type (ignoring cv-qualification) as the function return type. This variant of copy elision is known as NRVO, "named return value optimization".

`std::move()` prevents this optimization.

GCC 9.1.0 warning:
```
moving a local object in a return statement prevents copy elision [-Wpessimizing-move]
```
Pull Request resolved: https://github.com/facebook/folly/pull/1217

Reviewed By: LeeHowes

Differential Revision: D17173234

Pulled By: yfeldblum

fbshipit-source-id: ed63ef89dfd01883ddd6fd775285997f96a029fd
parent eea51e2d
...@@ -2061,7 +2061,7 @@ SemiFuture<T> SemiFuture<T>::within(Duration dur, E e, Timekeeper* tk) && { ...@@ -2061,7 +2061,7 @@ SemiFuture<T> SemiFuture<T>::within(Duration dur, E e, Timekeeper* tk) && {
nestedExecutors.emplace_back(ctx->afterFuture.stealDeferredExecutor()); nestedExecutors.emplace_back(ctx->afterFuture.stealDeferredExecutor());
futures::detail::getDeferredExecutor(fut)->setNestedExecutors( futures::detail::getDeferredExecutor(fut)->setNestedExecutors(
std::move(nestedExecutors)); std::move(nestedExecutors));
return std::move(fut); return fut;
} }
// delayed // delayed
......
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