Commit 1e06e1db authored by Hannes Roth's avatar Hannes Roth Committed by facebook-github-bot-9

(Wangle) Use perfect forwarding for LambdaBufHelper

Summary: Perfect forwarding only works if the function is templated on the same type, not if the type is a class template.

Discovered by @lbrandy.

Reviewed By: @yfeldblum, @lbrandy

Differential Revision: D2333005
parent 39080c90
...@@ -130,7 +130,8 @@ class Core { ...@@ -130,7 +130,8 @@ class Core {
template <typename F> template <typename F>
class LambdaBufHelper { class LambdaBufHelper {
public: public:
explicit LambdaBufHelper(F&& func) : func_(std::forward<F>(func)) {} template <typename FF>
explicit LambdaBufHelper(FF&& func) : func_(std::forward<FF>(func)) {}
void operator()(Try<T>&& t) { void operator()(Try<T>&& t) {
SCOPE_EXIT { this->~LambdaBufHelper(); }; SCOPE_EXIT { this->~LambdaBufHelper(); };
func_(std::move(t)); func_(std::move(t));
......
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