| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 #ifndef BASE_MEMORY_SCOPED_PTR_H_ | 77 #ifndef BASE_MEMORY_SCOPED_PTR_H_ |
| 78 #define BASE_MEMORY_SCOPED_PTR_H_ | 78 #define BASE_MEMORY_SCOPED_PTR_H_ |
| 79 | 79 |
| 80 // This is an implementation designed to match the anticipated future TR2 | 80 // This is an implementation designed to match the anticipated future TR2 |
| 81 // implementation of the scoped_ptr class. | 81 // implementation of the scoped_ptr class. |
| 82 | 82 |
| 83 #include <assert.h> | 83 #include <assert.h> |
| 84 #include <stddef.h> | 84 #include <stddef.h> |
| 85 #include <stdlib.h> | 85 #include <stdlib.h> |
| 86 | 86 |
| 87 // TODO(dcheng): Temporary, remove this #include since swap is defined in |
| 88 // <utility> in C++11. |
| 89 #include <algorithm> |
| 87 #include <iosfwd> | 90 #include <iosfwd> |
| 88 #include <memory> | 91 #include <memory> |
| 89 #include <utility> | 92 #include <utility> |
| 90 | 93 |
| 91 #include "base/basictypes.h" | 94 #include "base/basictypes.h" |
| 92 #include "base/compiler_specific.h" | 95 #include "base/compiler_specific.h" |
| 93 #include "base/move.h" | 96 #include "base/move.h" |
| 94 #include "base/template_util.h" | 97 #include "base/template_util.h" |
| 95 | 98 |
| 96 namespace base { | 99 namespace base { |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 scoped_ptr<T> make_scoped_ptr(T* ptr) { | 554 scoped_ptr<T> make_scoped_ptr(T* ptr) { |
| 552 return scoped_ptr<T>(ptr); | 555 return scoped_ptr<T>(ptr); |
| 553 } | 556 } |
| 554 | 557 |
| 555 template <typename T> | 558 template <typename T> |
| 556 std::ostream& operator<<(std::ostream& out, const scoped_ptr<T>& p) { | 559 std::ostream& operator<<(std::ostream& out, const scoped_ptr<T>& p) { |
| 557 return out << p.get(); | 560 return out << p.get(); |
| 558 } | 561 } |
| 559 | 562 |
| 560 #endif // BASE_MEMORY_SCOPED_PTR_H_ | 563 #endif // BASE_MEMORY_SCOPED_PTR_H_ |
| OLD | NEW |