From d9b87777d3af1a494c2cfbdeff559392d9f8c578 Mon Sep 17 00:00:00 2001 From: David Wells Date: Fri, 2 Oct 2015 14:53:10 -0400 Subject: [PATCH] Make memory_consumption(T*) more generic. --- include/deal.II/base/memory_consumption.h | 55 +++++------------------ 1 file changed, 10 insertions(+), 45 deletions(-) diff --git a/include/deal.II/base/memory_consumption.h b/include/deal.II/base/memory_consumption.h index 2e93c0e50a..58e9fcbb54 100644 --- a/include/deal.II/base/memory_consumption.h +++ b/include/deal.II/base/memory_consumption.h @@ -208,34 +208,18 @@ namespace MemoryConsumption std::size_t memory_consumption (const std::pair &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 - 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 + template 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 void is no type and a - * void* is thus not caught by the general T* 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 + template inline std::size_t - memory_consumption (const T *const) + memory_consumption(const T *const) { return sizeof(T *); } - template - inline - std::size_t - memory_consumption (T *const) - { - return sizeof(T *); - } - - - - inline - std::size_t - memory_consumption (void *const) - { - return sizeof(void *); - } - - - template inline std::size_t -- 2.39.5