]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add another overload for shared pointers.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 19 Dec 2005 21:08:59 +0000 (21:08 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 19 Dec 2005 21:08:59 +0000 (21:08 +0000)
git-svn-id: https://svn.dealii.org/trunk@11881 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/include/base/memory_consumption.h

index d9f8da7af930b8257a81d5d36ab713e1e2099db0..601b426bc64dd1f855b748a9ef68b0ea2f06bb36 100644 (file)
@@ -15,6 +15,7 @@
 
 
 #include <base/config.h>
+#include <boost/shared_ptr.hpp>
 #include <string>
 #include <vector>
 #include <utility>
@@ -331,7 +332,7 @@ namespace MemoryConsumption
   template <typename T>
   inline
   unsigned int memory_consumption (const T * const);
-
+  
                                   /**
                                    * Return the amount of memory
                                    * used by a pointer. Make sure
@@ -366,6 +367,17 @@ namespace MemoryConsumption
   inline
   unsigned int memory_consumption (void * const);
     
+                                  /**
+                                   * Return the amount of memory used
+                                   * by a boost shared pointer. Make
+                                   * sure that you are really
+                                   * interested in this, and not the
+                                   * amount of memory required by the
+                                   * object pointed to.
+                                   */
+  template <typename T>
+  inline
+  unsigned int memory_consumption (const boost::shared_ptr<T> &);
     
                                   /**
                                    * For all other types which are
@@ -584,7 +596,17 @@ namespace MemoryConsumption
   {
     return sizeof(void*);
   }
-    
+
+
+
+  template <typename T>
+  inline
+  unsigned int
+  memory_consumption (const boost::shared_ptr<T> &ptr)
+  {
+    return sizeof(ptr);
+  }
+  
     
        
   template <typename 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.