diff options
-rw-r--r-- | src/memusage.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/memusage.h b/src/memusage.h index bb39066a7d..08be66172e 100644 --- a/src/memusage.h +++ b/src/memusage.h @@ -11,6 +11,7 @@ #include <cassert> #include <cstdlib> +#include <list> #include <map> #include <memory> #include <set> @@ -149,6 +150,21 @@ static inline size_t DynamicUsage(const std::shared_ptr<X>& p) } template<typename X> +struct list_node +{ +private: + void* ptr_next; + void* ptr_prev; + X x; +}; + +template<typename X> +static inline size_t DynamicUsage(const std::list<X>& l) +{ + return MallocUsage(sizeof(list_node<X>)) * l.size(); +} + +template<typename X> struct unordered_node : private X { private: |