-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: We are often using `[f = std::forward<F>(f)]` in lambdas, in the goal of perfect-forwarding a callable `f`. Unfortunately, this does NOT actually perfectly-forward the value. When f is a reference, this leads to an extra copy, because the initializer expression in a generalized lambda capture does not have effect on the deduced type of the capture. This is better explained by Vittorio Romeo: https://vittorioromeo.info/index/blog/capturing_perfectly_forwarded_objects_in_lambdas.html To fix this issue, we can use a helper function `fwd_capture`. Note that this also allows us to use mutable lambdas. Reviewed By: arnaudvenet Differential Revision: D60187566 fbshipit-source-id: f19688f37a61219b5fb902a27816d2c66792b250
- Loading branch information
1 parent
850b004
commit 2e20749
Showing
10 changed files
with
255 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.