Bug 1189231 - Refine operator() call with perfect forwarding. r=nfroyd
authorJames Cheng <jacheng@mozilla.com>
Thu, 30 Jul 2015 21:16:00 -0400
changeset 287816 5cadf71b19b2de36440711aa22342c1952d7ffa6
parent 287815 312dce5d5216521b8b14a47c7cc5cabaafbd90bf
child 287817 9525bd4282076796d08c5ca60a01b177e9a5ef15
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnfroyd
bugs1189231
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1189231 - Refine operator() call with perfect forwarding. r=nfroyd
mfbt/nsRefPtr.h
--- a/mfbt/nsRefPtr.h
+++ b/mfbt/nsRefPtr.h
@@ -258,19 +258,20 @@ public:
     T* mRawPtr;
     member_function mFunction;
   public:
     Proxy(T* aRawPtr, member_function aFunction)
       : mRawPtr(aRawPtr),
         mFunction(aFunction)
     {
     }
-    R operator()(Args... aArgs)
+    template<typename... ActualArgs>
+    R operator()(ActualArgs&&... aArgs)
     {
-      return ((*mRawPtr).*mFunction)(mozilla::Forward<Args>(aArgs)...);
+      return ((*mRawPtr).*mFunction)(mozilla::Forward<ActualArgs>(aArgs)...);
     }
   };
 
   template <typename R, typename... Args>
   Proxy<R, Args...> operator->*(R (T::*aFptr)(Args...)) const
   {
     MOZ_ASSERT(mRawPtr != 0,
                "You can't dereference a NULL nsRefPtr with operator->*().");