(Wangle) Use perfect forwarding for LambdaBufHelper
authorHannes Roth <hannesr@fb.com>
Tue, 11 Aug 2015 23:11:59 +0000 (16:11 -0700)
committerfacebook-github-bot-9 <folly-bot@fb.com>
Wed, 12 Aug 2015 00:22:04 +0000 (17:22 -0700)
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

folly/futures/detail/Core.h

index 252af04a56071fae5b039d1c074b2a5c1e735d7d..bca540decf292449613af333cf24f10ea8b4a775 100644 (file)
@@ -130,7 +130,8 @@ class Core {
   template <typename F>
   class LambdaBufHelper {
    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) {
       SCOPE_EXIT { this->~LambdaBufHelper(); };
       func_(std::move(t));