| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project 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 V8_ZONE_CONTAINERS_H_ | 5 #ifndef V8_ZONE_CONTAINERS_H_ |
| 6 #define V8_ZONE_CONTAINERS_H_ | 6 #define V8_ZONE_CONTAINERS_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <list> | 9 #include <list> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 explicit ZoneSet(Zone* zone) | 107 explicit ZoneSet(Zone* zone) |
| 108 : std::set<K, Compare, zone_allocator<K>>(Compare(), | 108 : std::set<K, Compare, zone_allocator<K>>(Compare(), |
| 109 zone_allocator<K>(zone)) {} | 109 zone_allocator<K>(zone)) {} |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 | 112 |
| 113 // A wrapper subclass for std::map to make it easy to construct one that uses | 113 // A wrapper subclass for std::map to make it easy to construct one that uses |
| 114 // a zone allocator. | 114 // a zone allocator. |
| 115 template <typename K, typename V, typename Compare = std::less<K>> | 115 template <typename K, typename V, typename Compare = std::less<K>> |
| 116 class ZoneMap | 116 class ZoneMap |
| 117 : public std::map<K, V, Compare, zone_allocator<std::pair<K, V>>> { | 117 : public std::map<K, V, Compare, zone_allocator<std::pair<const K, V>>> { |
| 118 public: | 118 public: |
| 119 // Constructs an empty map. | 119 // Constructs an empty map. |
| 120 explicit ZoneMap(Zone* zone) | 120 explicit ZoneMap(Zone* zone) |
| 121 : std::map<K, V, Compare, zone_allocator<std::pair<K, V>>>( | 121 : std::map<K, V, Compare, zone_allocator<std::pair<const K, V>>>( |
| 122 Compare(), zone_allocator<std::pair<K, V>>(zone)) {} | 122 Compare(), zone_allocator<std::pair<const K, V>>(zone)) {} |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 | 125 |
| 126 // Typedefs to shorten commonly used vectors. | 126 // Typedefs to shorten commonly used vectors. |
| 127 typedef ZoneVector<bool> BoolVector; | 127 typedef ZoneVector<bool> BoolVector; |
| 128 typedef ZoneVector<int> IntVector; | 128 typedef ZoneVector<int> IntVector; |
| 129 | 129 |
| 130 } // namespace internal | 130 } // namespace internal |
| 131 } // namespace v8 | 131 } // namespace v8 |
| 132 | 132 |
| 133 #endif // V8_ZONE_CONTAINERS_H_ | 133 #endif // V8_ZONE_CONTAINERS_H_ |
| OLD | NEW |