diff options
author | kalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-18 23:16:40 +0000 |
---|---|---|
committer | kalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-18 23:16:40 +0000 |
commit | 568fdb7435d1bf63db95a4440ee426e7cba394c9 (patch) | |
tree | 78636e48c3b42b9c7eb46b7c7d40d7c82fe4b3f1 /base/memory | |
parent | fbc772b85c3f3d7b86a81a9d45e65578d60c2c07 (diff) | |
download | chromium_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.h | 8 |
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_ |