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

Unified Diff: base/memory/scoped_ptr.h

Issue 1845243004: Revert of Move make_scoped_ptr into //base/memory/ptr_util.h. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « base/memory/ptr_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/scoped_ptr.h
diff --git a/base/memory/scoped_ptr.h b/base/memory/scoped_ptr.h
index 37a980232bef963b59493e422b9724a4ea0db9ee..e63887483840e37e727bb3ccd8893e3bd6505b1a 100644
--- a/base/memory/scoped_ptr.h
+++ b/base/memory/scoped_ptr.h
@@ -11,10 +11,15 @@
#include <memory>
-// TODO(dcheng): Temporary, to facilitate transition off scoped_ptr.
-#include "base/memory/ptr_util.h"
-
template <typename T, typename D = std::default_delete<T>>
using scoped_ptr = std::unique_ptr<T, D>;
+// 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_
« no previous file with comments | « base/memory/ptr_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698