From: Matthias Maier Date: Sun, 29 Oct 2023 22:07:20 +0000 (-0500) Subject: base/lazy.h: add memory_consumption method to Lazy X-Git-Tag: relicensing~343^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84d69e8c1b6b9b5892925277b88900e326c56abf;p=dealii.git base/lazy.h: add memory_consumption method to Lazy --- diff --git a/include/deal.II/base/lazy.h b/include/deal.II/base/lazy.h index 307fbc9708..450230cd0a 100644 --- a/include/deal.II/base/lazy.h +++ b/include/deal.II/base/lazy.h @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -194,6 +195,12 @@ public: value_or_initialize(const Callable &creator); + /** + * Compute the memory consumption of this structure. + */ + std::size_t + memory_consumption() const; + private: /** * The lazily initialized object stored as a std::optional. @@ -396,5 +403,14 @@ Lazy::value_or_initialize(const Callable &creator) } +template +std::size_t +Lazy::memory_consumption() const +{ + return MemoryConsumption::memory_consumption(object) + // + sizeof(*this) - sizeof(object); +} + + DEAL_II_NAMESPACE_CLOSE #endif