From 22602b9a046850a7de9224f58638abfdbf836e76 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 7 Aug 2015 21:56:48 -0500 Subject: [PATCH] Add memory consumption function for std_cxx11::unique_ptr. --- doc/news/changes.h | 6 ++++++ include/deal.II/base/memory_consumption.h | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/doc/news/changes.h b/doc/news/changes.h index 771f038817..b687662028 100644 --- a/doc/news/changes.h +++ b/doc/news/changes.h @@ -90,6 +90,12 @@ inconvenience this causes.
    +
  1. New: There is now a function MemoryConsumption::memory_consumption() + for std_cxx11::unique_ptr arguments. +
    + (Wolfgang Bangerth, 2015/08/07) +
  2. +
  3. New: VtkFlags now stores a parameter describing the compression level zlib uses when writing compressed output. For small problems, the flag ZlibCompressionLevel::best_speed can make the call to write_vtu many times diff --git a/include/deal.II/base/memory_consumption.h b/include/deal.II/base/memory_consumption.h index 5f4553be66..83f9c7baa0 100644 --- a/include/deal.II/base/memory_consumption.h +++ b/include/deal.II/base/memory_consumption.h @@ -19,6 +19,7 @@ #include #include +#include #include #include @@ -355,6 +356,15 @@ namespace MemoryConsumption template inline std::size_t memory_consumption (const std_cxx11::shared_ptr &); + + /** + * Return the amount of memory used by a std_cxx11::unique_ptr object. + * + * @note This returns the size of the pointer, not of the object pointed to. + */ + template + inline + std::size_t memory_consumption (const std_cxx11::unique_ptr &); } @@ -628,6 +638,16 @@ namespace MemoryConsumption + template + inline + std::size_t + memory_consumption (const std_cxx11::unique_ptr &) + { + return sizeof(std_cxx11::unique_ptr); + } + + + template inline std::size_t -- 2.39.5