5 #ifndef V8_ZONE_ZONE_CONTAINERS_H_ 6 #define V8_ZONE_ZONE_CONTAINERS_H_ 9 #include <forward_list> 15 #include <unordered_map> 16 #include <unordered_set> 19 #include "src/base/functional.h" 20 #include "src/zone/zone-allocator.h" 28 class ZoneVector :
public std::vector<T, ZoneAllocator<T>> {
31 explicit ZoneVector(Zone* zone)
32 :
std::vector<T, ZoneAllocator<T>>(ZoneAllocator<T>(zone)) {}
36 ZoneVector(
size_t size, Zone* zone)
37 :
std::vector<T, ZoneAllocator<T>>(size, T(), ZoneAllocator<T>(zone)) {}
41 ZoneVector(
size_t size, T def, Zone* zone)
42 :
std::vector<T, ZoneAllocator<T>>(size, def, ZoneAllocator<T>(zone)) {}
46 ZoneVector(std::initializer_list<T> list, Zone* zone)
47 :
std::vector<T, ZoneAllocator<T>>(list, ZoneAllocator<T>(zone)) {}
51 template <
class InputIt>
52 ZoneVector(InputIt first, InputIt last, Zone* zone)
53 :
std::vector<T, ZoneAllocator<T>>(first, last, ZoneAllocator<T>(zone)) {}
59 class ZoneDeque :
public std::deque<T, RecyclingZoneAllocator<T>> {
63 : std::deque<T, RecyclingZoneAllocator<T>>(
91 template <
typename T,
typename Compare = std::less<T>>
93 :
public std::priority_queue<T, ZoneVector<T>, Compare> {
97 : std::priority_queue<T, ZoneVector<T>, Compare>(Compare(),
103 template <
typename T>
113 template <
typename T>
123 template <
typename K,
typename Compare = std::less<K>>
124 class ZoneSet :
public std::set<K, Compare, ZoneAllocator<K>> {
128 : std::set<K, Compare, ZoneAllocator<K>>(Compare(),
134 template <
typename K,
typename Compare = std::less<K>>
135 class ZoneMultiset :
public std::multiset<K, Compare, ZoneAllocator<K>> {
139 : std::multiset<K, Compare, ZoneAllocator<K>>(Compare(),
145 template <
typename K,
typename V,
typename Compare = std::less<K>>
147 :
public std::map<K, V, Compare, ZoneAllocator<std::pair<const K, V>>> {
151 : std::map<K, V, Compare, ZoneAllocator<std::pair<const K, V>>>(
157 template <
typename K,
typename V,
typename Hash = base::hash<K>,
158 typename KeyEqual = std::equal_to<K>>
160 :
public std::unordered_map<K, V, Hash, KeyEqual,
161 ZoneAllocator<std::pair<const K, V>>> {
165 : std::unordered_map<K, V, Hash, KeyEqual,
167 bucket_count, Hash(), KeyEqual(),
173 template <
typename K,
typename Hash = base::hash<K>,
174 typename KeyEqual = std::equal_to<K>>
176 :
public std::unordered_set<K, Hash, KeyEqual, ZoneAllocator<K>> {
180 : std::unordered_set<K, Hash, KeyEqual, ZoneAllocator<K>>(
186 template <
typename K,
typename V,
typename Compare = std::less<K>>
188 :
public std::multimap<K, V, Compare,
189 ZoneAllocator<std::pair<const K, V>>> {
193 : std::multimap<K, V, Compare, ZoneAllocator<std::pair<const K, V>>>(
204 #endif // V8_ZONE_ZONE_CONTAINERS_H_