Add RecursiveDynamicUsage overload for std::shared_ptr

This simplifies a few usage expressions.
This commit is contained in:
Russell Yanofsky
2016-11-21 11:47:12 -05:00
committed by Suhas Daftuar
parent 71f1903353
commit c1235e3f2d
3 changed files with 9 additions and 4 deletions

View File

@@ -63,4 +63,9 @@ static inline size_t RecursiveDynamicUsage(const CBlockLocator& locator) {
return memusage::DynamicUsage(locator.vHave);
}
template<typename X>
static inline size_t RecursiveDynamicUsage(const std::shared_ptr<X>& p) {
return p ? memusage::DynamicUsage(p) + RecursiveDynamicUsage(*p) : 0;
}
#endif // BITCOIN_CORE_MEMUSAGE_H