Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: webrtc/base/scoped_ref_ptr.h

Issue 2193443002: Adds move assignment operator to scoped_refptr (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/scoped_ref_ptr.h
diff --git a/webrtc/base/scoped_ref_ptr.h b/webrtc/base/scoped_ref_ptr.h
index ceee445216a3ce6af300c7830f19f528049e4c2c..df669121dcf77ecdc36b43e86906412e7d66e024 100644
--- a/webrtc/base/scoped_ref_ptr.h
+++ b/webrtc/base/scoped_ref_ptr.h
@@ -63,7 +63,7 @@
#ifndef WEBRTC_BASE_SCOPED_REF_PTR_H_
#define WEBRTC_BASE_SCOPED_REF_PTR_H_
-#include <stddef.h>
+#include <memory>
namespace rtc {
@@ -134,6 +134,17 @@ class scoped_refptr {
return *this = r.get();
}
+ scoped_refptr<T>& operator=(scoped_refptr<T>&& r) {
+ scoped_refptr<T>(std::move(r)).swap(*this);
Taylor Brandstetter 2016/08/01 20:00:36 I realize this uses the same method as Chromium's
+ return *this;
+ }
+
+ template <typename U>
+ scoped_refptr<T>& operator=(scoped_refptr<U>&& r) {
+ scoped_refptr<T>(std::move(r)).swap(*this);
+ return *this;
+ }
+
void swap(T** pp) {
T* p = ptr_;
ptr_ = *pp;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698