1212#include < map>
1313#include < set>
1414#include < vector>
15+ #include < unordered_map>
16+ #include < unordered_set>
1517
1618#include < boost/foreach.hpp>
1719#include < boost/unordered_set.hpp>
@@ -149,7 +151,7 @@ static inline size_t DynamicUsage(const std::shared_ptr<X>& p)
149151// Boost data structures
150152
151153template <typename X>
152- struct boost_unordered_node : private X
154+ struct unordered_node : private X
153155{
154156private:
155157 void * ptr;
@@ -158,13 +160,25 @@ struct boost_unordered_node : private X
158160template <typename X, typename Y>
159161static inline size_t DynamicUsage (const boost::unordered_set<X, Y>& s)
160162{
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 ());
162164}
163165
164166template <typename X, typename Y, typename Z>
165167static inline size_t DynamicUsage (const boost::unordered_map<X, Y, Z>& m)
166168{
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 ());
168182}
169183
170184}
0 commit comments