OLD | NEW |
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 // Scopers help you manage ownership of a pointer, helping you easily manage a | 5 // Scopers help you manage ownership of a pointer, helping you easily manage a |
6 // pointer within a scope, and automatically destroying the pointer at the end | 6 // pointer within a scope, and automatically destroying the pointer at the end |
7 // of a scope. There are two main classes you will use, which correspond to the | 7 // of a scope. There are two main classes you will use, which correspond to the |
8 // operators new/delete and new[]/delete[]. | 8 // operators new/delete and new[]/delete[]. |
9 // | 9 // |
10 // Example usage (scoped_ptr<T>): | 10 // Example usage (scoped_ptr<T>): |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 #include <assert.h> | 84 #include <assert.h> |
85 #include <stddef.h> | 85 #include <stddef.h> |
86 #include <stdlib.h> | 86 #include <stdlib.h> |
87 | 87 |
88 #include <iosfwd> | 88 #include <iosfwd> |
89 #include <memory> | 89 #include <memory> |
90 #include <type_traits> | 90 #include <type_traits> |
91 #include <utility> | 91 #include <utility> |
92 | 92 |
93 #include "base/basictypes.h" | |
94 #include "base/compiler_specific.h" | 93 #include "base/compiler_specific.h" |
| 94 #include "base/macros.h" |
95 #include "base/move.h" | 95 #include "base/move.h" |
96 #include "base/template_util.h" | 96 #include "base/template_util.h" |
97 | 97 |
98 namespace base { | 98 namespace base { |
99 | 99 |
100 namespace subtle { | 100 namespace subtle { |
101 class RefCountedBase; | 101 class RefCountedBase; |
102 class RefCountedThreadSafeBase; | 102 class RefCountedThreadSafeBase; |
103 } // namespace subtle | 103 } // namespace subtle |
104 | 104 |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 scoped_ptr<T> make_scoped_ptr(T* ptr) { | 598 scoped_ptr<T> make_scoped_ptr(T* ptr) { |
599 return scoped_ptr<T>(ptr); | 599 return scoped_ptr<T>(ptr); |
600 } | 600 } |
601 | 601 |
602 template <typename T> | 602 template <typename T> |
603 std::ostream& operator<<(std::ostream& out, const scoped_ptr<T>& p) { | 603 std::ostream& operator<<(std::ostream& out, const scoped_ptr<T>& p) { |
604 return out << p.get(); | 604 return out << p.get(); |
605 } | 605 } |
606 | 606 |
607 #endif // BASE_MEMORY_SCOPED_PTR_H_ | 607 #endif // BASE_MEMORY_SCOPED_PTR_H_ |
OLD | NEW |