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

Side by Side Diff: base/memory/scoped_ptr.h

Issue 1838323002: Move make_scoped_ptr into //base/memory/ptr_util.h. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment fix Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « base/memory/ptr_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // scoped_ptr is just a type alias for std::unique_ptr. Mass conversion coming 5 // scoped_ptr is just a type alias for std::unique_ptr. Mass conversion coming
6 // soon (stay tuned for the PSA!), but until then, please continue using 6 // soon (stay tuned for the PSA!), but until then, please continue using
7 // scoped_ptr. 7 // scoped_ptr.
8 8
9 #ifndef BASE_MEMORY_SCOPED_PTR_H_ 9 #ifndef BASE_MEMORY_SCOPED_PTR_H_
10 #define BASE_MEMORY_SCOPED_PTR_H_ 10 #define BASE_MEMORY_SCOPED_PTR_H_
11 11
12 #include <memory> 12 #include <memory>
13 13
14 // TODO(dcheng): Temporary, to facilitate transition off scoped_ptr.
15 #include "base/memory/ptr_util.h"
16
14 template <typename T, typename D = std::default_delete<T>> 17 template <typename T, typename D = std::default_delete<T>>
15 using scoped_ptr = std::unique_ptr<T, D>; 18 using scoped_ptr = std::unique_ptr<T, D>;
16 19
17 // A function to convert T* into scoped_ptr<T>
18 // Doing e.g. make_scoped_ptr(new FooBarBaz<type>(arg)) is a shorter notation
19 // for scoped_ptr<FooBarBaz<type> >(new FooBarBaz<type>(arg))
20 template <typename T>
21 scoped_ptr<T> make_scoped_ptr(T* ptr) {
22 return scoped_ptr<T>(ptr);
23 }
24
25 #endif // BASE_MEMORY_SCOPED_PTR_H_ 20 #endif // BASE_MEMORY_SCOPED_PTR_H_
OLDNEW
« 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