summaryrefslogtreecommitdiffstats
path: root/base/memory
diff options
context:
space:
mode:
authorkalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-18 23:16:40 +0000
committerkalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-18 23:16:40 +0000
commit568fdb7435d1bf63db95a4440ee426e7cba394c9 (patch)
tree78636e48c3b42b9c7eb46b7c7d40d7c82fe4b3f1 /base/memory
parentfbc772b85c3f3d7b86a81a9d45e65578d60c2c07 (diff)
downloadchromium_src-568fdb7435d1bf63db95a4440ee426e7cba394c9.zip
chromium_src-568fdb7435d1bf63db95a4440ee426e7cba394c9.tar.gz
chromium_src-568fdb7435d1bf63db95a4440ee426e7cba394c9.tar.bz2
Add make_scoped_ptr to scoped_ptr.h
Review URL: https://chromiumcodereview.appspot.com/10565038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142848 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/memory')
-rw-r--r--base/memory/scoped_ptr.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/base/memory/scoped_ptr.h b/base/memory/scoped_ptr.h
index bc38c8d..4bded15 100644
--- a/base/memory/scoped_ptr.h
+++ b/base/memory/scoped_ptr.h
@@ -493,4 +493,12 @@ bool operator!=(C* p, const scoped_ptr_malloc<C, FP>& b) {
return p != b.get();
}
+// A function to convert T* into scoped_ptr<T>
+// Doing e.g. make_scoped_ptr(new FooBarBaz<type>(arg)) is a shorter notation
+// for scoped_ptr<FooBarBaz<type> >(new FooBarBaz<type>(arg))
+template <typename T>
+scoped_ptr<T> make_scoped_ptr(T* ptr) {
+ return scoped_ptr<T>(ptr);
+}
+
#endif // BASE_MEMORY_SCOPED_PTR_H_