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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 public: | 59 public: |
60 // Constructs an empty list. | 60 // Constructs an empty list. |
61 explicit ZoneLinkedList(Zone* zone) | 61 explicit ZoneLinkedList(Zone* zone) |
62 : std::list<T, zone_allocator<T>>(zone_allocator<T>(zone)) {} | 62 : std::list<T, zone_allocator<T>>(zone_allocator<T>(zone)) {} |
63 }; | 63 }; |
64 | 64 |
65 | 65 |
66 // A wrapper subclass std::priority_queue to make it easy to construct one | 66 // A wrapper subclass std::priority_queue to make it easy to construct one |
67 // that uses a zone allocator. | 67 // that uses a zone allocator. |
68 template <typename T, typename Compare = std::less<T>> | 68 template <typename T, typename Compare = std::less<T>> |
69 class ZonePriorityQueue : public std::priority_queue<T, ZoneVector<T>> { | 69 class ZonePriorityQueue |
| 70 : public std::priority_queue<T, ZoneVector<T>, Compare> { |
70 public: | 71 public: |
71 // Constructs an empty list. | 72 // Constructs an empty list. |
72 explicit ZonePriorityQueue(Zone* zone) | 73 explicit ZonePriorityQueue(Zone* zone) |
73 : std::priority_queue<T, ZoneVector<T>>(Compare(), ZoneVector<T>(zone)) {} | 74 : std::priority_queue<T, ZoneVector<T>, Compare>(Compare(), |
| 75 ZoneVector<T>(zone)) {} |
74 }; | 76 }; |
75 | 77 |
76 | 78 |
77 // A wrapper subclass for std::queue to make it easy to construct one | 79 // A wrapper subclass for std::queue to make it easy to construct one |
78 // that uses a zone allocator. | 80 // that uses a zone allocator. |
79 template <typename T> | 81 template <typename T> |
80 class ZoneQueue : public std::queue<T, ZoneDeque<T>> { | 82 class ZoneQueue : public std::queue<T, ZoneDeque<T>> { |
81 public: | 83 public: |
82 // Constructs an empty queue. | 84 // Constructs an empty queue. |
83 explicit ZoneQueue(Zone* zone) | 85 explicit ZoneQueue(Zone* zone) |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 124 |
123 | 125 |
124 // Typedefs to shorten commonly used vectors. | 126 // Typedefs to shorten commonly used vectors. |
125 typedef ZoneVector<bool> BoolVector; | 127 typedef ZoneVector<bool> BoolVector; |
126 typedef ZoneVector<int> IntVector; | 128 typedef ZoneVector<int> IntVector; |
127 | 129 |
128 } // namespace internal | 130 } // namespace internal |
129 } // namespace v8 | 131 } // namespace v8 |
130 | 132 |
131 #endif // V8_ZONE_CONTAINERS_H_ | 133 #endif // V8_ZONE_CONTAINERS_H_ |
OLD | NEW |