summaryrefslogtreecommitdiffstats
path: root/base/memory
diff options
context:
space:
mode:
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_