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

Unified Diff: base/mac/scoped_nsobject.h

Issue 848033006: Allow copying scoped_nsobject of different type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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: base/mac/scoped_nsobject.h
diff --git a/base/mac/scoped_nsobject.h b/base/mac/scoped_nsobject.h
index 8d7bd4a27bd37c2844704e8beb2f0ef3bb849469..8814b51439b6f76e96e3e235bb620438009cdc50 100644
--- a/base/mac/scoped_nsobject.h
+++ b/base/mac/scoped_nsobject.h
@@ -40,6 +40,11 @@ class scoped_nsprotocol {
: object_([that.object_ retain]) {
}
+ template <typename NSU>
+ scoped_nsprotocol(const scoped_nsprotocol<NSU>& that)
+ : object_([that.get() retain]) {
+ }
+
~scoped_nsprotocol() {
[object_ release];
}
@@ -119,6 +124,11 @@ class scoped_nsobject : public scoped_nsprotocol<NST*> {
: scoped_nsprotocol<NST*>(that) {
}
+ template<typename NSU>
+ scoped_nsobject(const scoped_nsobject<NSU>& that)
+ : scoped_nsprotocol<NST*>(that) {
+ }
+
scoped_nsobject& operator=(const scoped_nsobject<NST>& that) {
scoped_nsprotocol<NST*>::operator=(that);
return *this;
@@ -135,6 +145,11 @@ class scoped_nsobject<id> : public scoped_nsprotocol<id> {
: scoped_nsprotocol<id>(that) {
}
+ template<typename NSU>
+ scoped_nsobject(const scoped_nsobject<NSU>& that)
+ : scoped_nsprotocol<id>(that) {
+ }
+
scoped_nsobject& operator=(const scoped_nsobject<id>& that) {
scoped_nsprotocol<id>::operator=(that);
return *this;
« 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