OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 // This is a simplistic insertion-ordered map. It behaves similarly to an STL | 5 // This is a simplistic insertion-ordered map. It behaves similarly to an STL |
6 // map, but only implements a small subset of the map's methods. Internally, we | 6 // map, but only implements a small subset of the map's methods. Internally, we |
7 // just keep a map and a list going in parallel. | 7 // just keep a map and a list going in parallel. |
8 // | 8 // |
9 // This class provides no thread safety guarantees, beyond what you would | 9 // This class provides no thread safety guarantees, beyond what you would |
10 // normally see with std::list. | 10 // normally see with std::list. |
11 // | 11 // |
12 // Iterators should be stable in the face of mutations, except for an | 12 // Iterators should be stable in the face of mutations, except for an |
13 // iterator pointing to an element that was just deleted. | 13 // iterator pointing to an element that was just deleted. |
14 | 14 |
15 #ifndef UTIL_GTL_LINKED_HASH_MAP_H_ | 15 #ifndef UTIL_GTL_LINKED_HASH_MAP_H_ |
16 #define UTIL_GTL_LINKED_HASH_MAP_H_ | 16 #define UTIL_GTL_LINKED_HASH_MAP_H_ |
17 | 17 |
| 18 #include <stddef.h> |
| 19 |
18 #include <list> | 20 #include <list> |
19 #include <utility> | 21 #include <utility> |
20 | 22 |
21 #include "base/containers/hash_tables.h" | 23 #include "base/containers/hash_tables.h" |
22 #include "base/logging.h" | 24 #include "base/logging.h" |
23 #include "base/macros.h" | 25 #include "base/macros.h" |
24 | 26 |
25 // This holds a list of pair<Key, Value> items. This list is what gets | 27 // This holds a list of pair<Key, Value> items. This list is what gets |
26 // traversed, and it's iterators from this list that we return from | 28 // traversed, and it's iterators from this list that we return from |
27 // begin/end/find. | 29 // begin/end/find. |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 | 235 |
234 // The list component, used for maintaining insertion order | 236 // The list component, used for maintaining insertion order |
235 ListType list_; | 237 ListType list_; |
236 | 238 |
237 // |map_| contains iterators to |list_|, therefore a default copy constructor | 239 // |map_| contains iterators to |list_|, therefore a default copy constructor |
238 // or copy assignment operator would result in an inconsistent state. | 240 // or copy assignment operator would result in an inconsistent state. |
239 DISALLOW_COPY_AND_ASSIGN(linked_hash_map); | 241 DISALLOW_COPY_AND_ASSIGN(linked_hash_map); |
240 }; | 242 }; |
241 | 243 |
242 #endif // UTIL_GTL_LINKED_HASH_MAP_H_ | 244 #endif // UTIL_GTL_LINKED_HASH_MAP_H_ |
OLD | NEW |