Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: src/zone-containers.h

Issue 1479893002: Allocators for map<K, V> need to allocate pair<const K, V>. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/instruction.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_
OLDNEW
« no previous file with comments | « src/compiler/instruction.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698