]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add memory consumption function for std_cxx11::unique_ptr.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Sat, 8 Aug 2015 02:56:48 +0000 (21:56 -0500)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Sat, 8 Aug 2015 19:31:17 +0000 (14:31 -0500)
doc/news/changes.h
include/deal.II/base/memory_consumption.h

index 771f038817332a2ab0766ae8d66c5b082eaa48f9..b687662028e8564f32930bebde2cdf697153c126 100644 (file)
@@ -90,6 +90,12 @@ inconvenience this causes.
 
 
 <ol>
+  <li> New: There is now a function MemoryConsumption::memory_consumption()
+  for std_cxx11::unique_ptr arguments.
+  <br>
+  (Wolfgang Bangerth, 2015/08/07)
+  </li>
+
   <li> 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
index 5f4553be667957e2264f6bf7199eaafdf80f709e..83f9c7baa0765e81651628e9a940f16a1cf6e04a 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <deal.II/base/config.h>
 #include <deal.II/base/std_cxx11/shared_ptr.h>
+#include <deal.II/base/std_cxx11/unique_ptr.h>
 
 #include <string>
 #include <complex>
@@ -355,6 +356,15 @@ namespace MemoryConsumption
   template <typename T>
   inline
   std::size_t memory_consumption (const std_cxx11::shared_ptr<T> &);
+
+  /**
+   * 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 <typename T>
+  inline
+  std::size_t memory_consumption (const std_cxx11::unique_ptr<T> &);
 }
 
 
@@ -628,6 +638,16 @@ namespace MemoryConsumption
 
 
 
+  template <typename T>
+  inline
+  std::size_t
+  memory_consumption (const std_cxx11::unique_ptr<T> &)
+  {
+    return sizeof(std_cxx11::unique_ptr<T>);
+  }
+
+
+
   template <typename T>
   inline
   std::size_t

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.