]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make memory_consumption(T*) more generic.
authorDavid Wells <wellsd2@rpi.edu>
Fri, 2 Oct 2015 18:53:10 +0000 (14:53 -0400)
committerDavid Wells <wellsd2@rpi.edu>
Fri, 2 Oct 2015 20:27:29 +0000 (16:27 -0400)
include/deal.II/base/memory_consumption.h

index 2e93c0e50a82c4cd601efdd21ccc7569c5b08d7c..58e9fcbb54f80e79e32b2dc2bbf63965fb9af653 100644 (file)
@@ -208,34 +208,18 @@ namespace MemoryConsumption
   std::size_t memory_consumption (const std::pair<A,B> &p);
 
   /**
-   * Return the amount of memory used by a pointer.
+   * Calculate the memory consumption of a pointer.
    *
-   * @note This returns the size of the pointer, not of the object pointed to.
-   */
-  template <typename T>
-  inline
-  std::size_t memory_consumption (const T *const);
-
-  /**
-   * Return the amount of memory used by a pointer.
+   * @note This function is overloaded for C-style strings; see the
+   * documentation of that function for that case.
    *
-   * @note This returns the size of the pointer, not of the object pointed to.
+   * @note This returns the size of the pointer, not the size of the object
+   * pointed to.
    */
-  template <typename T>
+  template<typename T>
   inline
-  std::size_t memory_consumption (T *const);
-
-  /**
-   * Return the amount of memory used by a void pointer.
-   *
-   * Note that we needed this function since <tt>void</tt> is no type and a
-   * <tt>void*</tt> is thus not caught by the general <tt>T*</tt> template
-   * function above.
-   *
-   * @note This returns the size of the pointer, not of the object pointed to.
-   */
-  inline
-  std::size_t memory_consumption (void *const);
+  std::size_t
+  memory_consumption (const T *const);
 
   /**
    * Return the amount of memory used by a shared pointer.
@@ -364,35 +348,16 @@ namespace MemoryConsumption
 
 
 
-  template <typename T>
+  template<typename T>
   inline
   std::size_t
-  memory_consumption (const T *const)
+  memory_consumption(const T *const)
   {
     return sizeof(T *);
   }
 
 
 
-  template <typename T>
-  inline
-  std::size_t
-  memory_consumption (T *const)
-  {
-    return sizeof(T *);
-  }
-
-
-
-  inline
-  std::size_t
-  memory_consumption (void *const)
-  {
-    return sizeof(void *);
-  }
-
-
-
   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.