Bug 1129877 - Add a templatized move constructor for nsRefPtr. v1 r=froydnj a=lmandel
authorBobby Holley <bobbyholley@gmail.com>
Mon, 09 Feb 2015 18:32:12 -0800
changeset 249845 93da569af52db3a791a9ded3a4492fcbcaad4e6e
parent 249844 aa21f0b505eb73f38c7adb4b18c946e5ddd78945
child 249846 81514026836140e8600bc6fa0c2d1f1de8058183
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj, lmandel
bugs1129877
milestone37.0a2
Bug 1129877 - Add a templatized move constructor for nsRefPtr. v1 r=froydnj a=lmandel
xpcom/base/nsRefPtr.h
--- a/xpcom/base/nsRefPtr.h
+++ b/xpcom/base/nsRefPtr.h
@@ -103,16 +103,23 @@ public:
 
   template <typename I>
   nsRefPtr(already_AddRefed<I>&& aSmartPtr)
     : mRawPtr(aSmartPtr.take())
     // construct from |otherRefPtr.forget()|
   {
   }
 
+  template <typename I>
+  nsRefPtr(nsRefPtr<I>&& aSmartPtr)
+    : mRawPtr(aSmartPtr.forget().take())
+    // construct from |Move(nsRefPtr<SomeSubclassOfT>)|.
+  {
+  }
+
   MOZ_IMPLICIT nsRefPtr(const nsCOMPtr_helper& aHelper);
 
   // Assignment operators
 
   nsRefPtr<T>&
   operator=(const nsRefPtr<T>& aRhs)
   // copy assignment operator
   {