12
12
#include < map>
13
13
#include < set>
14
14
#include < vector>
15
+ #include < unordered_map>
16
+ #include < unordered_set>
15
17
16
18
#include < boost/foreach.hpp>
17
19
#include < boost/unordered_set.hpp>
@@ -149,7 +151,7 @@ static inline size_t DynamicUsage(const std::shared_ptr<X>& p)
149
151
// Boost data structures
150
152
151
153
template <typename X>
152
- struct boost_unordered_node : private X
154
+ struct unordered_node : private X
153
155
{
154
156
private:
155
157
void * ptr;
@@ -158,13 +160,25 @@ struct boost_unordered_node : private X
158
160
template <typename X, typename Y>
159
161
static inline size_t DynamicUsage (const boost::unordered_set<X, Y>& s)
160
162
{
161
- return MallocUsage (sizeof (boost_unordered_node <X>)) * s.size () + MallocUsage (sizeof (void *) * s.bucket_count ());
163
+ return MallocUsage (sizeof (unordered_node <X>)) * s.size () + MallocUsage (sizeof (void *) * s.bucket_count ());
162
164
}
163
165
164
166
template <typename X, typename Y, typename Z>
165
167
static inline size_t DynamicUsage (const boost::unordered_map<X, Y, Z>& m)
166
168
{
167
- return MallocUsage (sizeof (boost_unordered_node<std::pair<const X, Y> >)) * m.size () + MallocUsage (sizeof (void *) * m.bucket_count ());
169
+ return MallocUsage (sizeof (unordered_node<std::pair<const X, Y> >)) * m.size () + MallocUsage (sizeof (void *) * m.bucket_count ());
170
+ }
171
+
172
+ template <typename X, typename Y>
173
+ static inline size_t DynamicUsage (const std::unordered_set<X, Y>& s)
174
+ {
175
+ return MallocUsage (sizeof (unordered_node<X>)) * s.size () + MallocUsage (sizeof (void *) * s.bucket_count ());
176
+ }
177
+
178
+ template <typename X, typename Y, typename Z>
179
+ static inline size_t DynamicUsage (const std::unordered_map<X, Y, Z>& m)
180
+ {
181
+ return MallocUsage (sizeof (unordered_node<std::pair<const X, Y> >)) * m.size () + MallocUsage (sizeof (void *) * m.bucket_count ());
168
182
}
169
183
170
184
}
0 commit comments