OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #ifndef CC_BASE_SCOPED_PTR_HASH_MAP_H_ | 5 #ifndef BASE_CONTAINERS_SCOPED_PTR_HASH_MAP_H_ |
6 #define CC_BASE_SCOPED_PTR_HASH_MAP_H_ | 6 #define BASE_CONTAINERS_SCOPED_PTR_HASH_MAP_H_ |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/containers/hash_tables.h" | 12 #include "base/containers/hash_tables.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
16 | 16 |
17 namespace cc { | 17 namespace base { |
18 | 18 |
19 // This type acts like a hash_map<K, scoped_ptr<V> >, based on top of | 19 // This type acts like a hash_map<K, scoped_ptr<V> >, based on top of |
20 // base::hash_map. The ScopedPtrHashMap has ownership of all values in the data | 20 // base::hash_map. The ScopedPtrHashMap has ownership of all values in the data |
21 // structure. | 21 // structure. |
22 template <typename Key, typename Value> | 22 template <typename Key, typename Value> |
23 class ScopedPtrHashMap { | 23 class ScopedPtrHashMap { |
24 typedef base::hash_map<Key, Value*> Container; | 24 typedef base::hash_map<Key, Value*> Container; |
25 | 25 |
26 public: | 26 public: |
27 typedef typename Container::iterator iterator; | 27 typedef typename Container::iterator iterator; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 inline const_iterator begin() const { return data_.begin(); } | 145 inline const_iterator begin() const { return data_.begin(); } |
146 inline iterator end() { return data_.end(); } | 146 inline iterator end() { return data_.end(); } |
147 inline const_iterator end() const { return data_.end(); } | 147 inline const_iterator end() const { return data_.end(); } |
148 | 148 |
149 private: | 149 private: |
150 Container data_; | 150 Container data_; |
151 | 151 |
152 DISALLOW_COPY_AND_ASSIGN(ScopedPtrHashMap); | 152 DISALLOW_COPY_AND_ASSIGN(ScopedPtrHashMap); |
153 }; | 153 }; |
154 | 154 |
155 } // namespace cc | 155 } // namespace base |
156 | 156 |
157 #endif // CC_BASE_SCOPED_PTR_HASH_MAP_H_ | 157 #endif // BASE_CONTAINERS_SCOPED_PTR_HASH_MAP_H_ |
OLD | NEW |