OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef BASE_SCOPED_GENERIC_H_ | 5 #ifndef BASE_SCOPED_GENERIC_H_ |
6 #define BASE_SCOPED_GENERIC_H_ | 6 #define BASE_SCOPED_GENERIC_H_ |
7 | 7 |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/macros.h" |
13 #include "base/move.h" | 14 #include "base/move.h" |
14 | 15 |
15 namespace base { | 16 namespace base { |
16 | 17 |
17 // This class acts like ScopedPtr with a custom deleter (although is slightly | 18 // This class acts like ScopedPtr with a custom deleter (although is slightly |
18 // less fancy in some of the more escoteric respects) except that it keeps a | 19 // less fancy in some of the more escoteric respects) except that it keeps a |
19 // copy of the object rather than a pointer, and we require that the contained | 20 // copy of the object rather than a pointer, and we require that the contained |
20 // object has some kind of "invalid" value. | 21 // object has some kind of "invalid" value. |
21 // | 22 // |
22 // Defining a scoper based on this class allows you to get a scoper for | 23 // Defining a scoper based on this class allows you to get a scoper for |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 } | 174 } |
174 | 175 |
175 template<class T, class Traits> | 176 template<class T, class Traits> |
176 bool operator!=(const T& value, const ScopedGeneric<T, Traits>& scoped) { | 177 bool operator!=(const T& value, const ScopedGeneric<T, Traits>& scoped) { |
177 return value != scoped.get(); | 178 return value != scoped.get(); |
178 } | 179 } |
179 | 180 |
180 } // namespace base | 181 } // namespace base |
181 | 182 |
182 #endif // BASE_SCOPED_GENERIC_H_ | 183 #endif // BASE_SCOPED_GENERIC_H_ |
OLD | NEW |