We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 59a35a7 commit 79ce9f0Copy full SHA for 79ce9f0
src/memusage.h
@@ -11,6 +11,7 @@
11
12
#include <cassert>
13
#include <cstdlib>
14
+#include <list>
15
#include <map>
16
#include <memory>
17
#include <set>
@@ -148,6 +149,21 @@ static inline size_t DynamicUsage(const std::shared_ptr<X>& p)
148
149
return p ? MallocUsage(sizeof(X)) + MallocUsage(sizeof(stl_shared_counter)) : 0;
150
}
151
152
+template<typename X>
153
+struct list_node
154
+{
155
+private:
156
+ void* ptr_next;
157
+ void* ptr_prev;
158
+ X x;
159
+};
160
+
161
162
+static inline size_t DynamicUsage(const std::list<X>& l)
163
164
+ return MallocUsage(sizeof(list_node<X>)) * l.size();
165
+}
166
167
template<typename X>
168
struct unordered_node : private X
169
{
0 commit comments