From: David Wells Date: Fri, 2 Oct 2015 18:34:03 +0000 (-0400) Subject: Remove memory_consumption(std::vector) et al. X-Git-Tag: v8.4.0-rc2~339^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f7f3ded069131c77cb732bd3f50f76ce24a02dd8;p=dealii.git Remove memory_consumption(std::vector) et al. This may be implemented generically now that an implementation of memory_consumption for all fundamental types is available. --- diff --git a/include/deal.II/base/memory_consumption.h b/include/deal.II/base/memory_consumption.h index d9bf795b7a..2e93c0e50a 100644 --- a/include/deal.II/base/memory_consumption.h +++ b/include/deal.II/base/memory_consumption.h @@ -199,50 +199,6 @@ namespace MemoryConsumption inline std::size_t memory_consumption (const std::vector &v); - /** - * Specialization of the determination of the memory consumption of a - * vector, here for a vector of ints. - */ - inline - std::size_t memory_consumption (const std::vector &v); - - /** - * Specialization of the determination of the memory consumption of a - * vector, here for a vector of doubles. - */ - inline - std::size_t memory_consumption (const std::vector &v); - - /** - * Specialization of the determination of the memory consumption of a - * vector, here for a vector of floats. - */ - inline - std::size_t memory_consumption (const std::vector &v); - - /** - * Specialization of the determination of the memory consumption of a - * vector, here for a vector of chars. - */ - inline - std::size_t memory_consumption (const std::vector &v); - - /** - * Specialization of the determination of the memory consumption of a - * vector, here for a vector of unsigned chars. - */ - inline - std::size_t memory_consumption (const std::vector &v); - - /** - * Specialization of the determination of the memory consumption of a - * vector, here for a vector of pointers. - */ - template - inline - std::size_t memory_consumption (const std::vector &v); - - /** * Determine an estimate of the amount of memory in bytes consumed by a pair * of values. @@ -360,12 +316,21 @@ namespace MemoryConsumption template std::size_t memory_consumption (const std::vector &v) { - std::size_t mem = sizeof(std::vector); - const unsigned int n = static_cast(v.size()); - for (unsigned int i=0; i::value || std_cxx11::is_pointer::value) + { + return v.capacity()*sizeof(T) + sizeof(v); + } + else + { + std::size_t mem = sizeof(std::vector); + for (unsigned int i=0; i &v) - { - return (v.capacity() * sizeof(int) + - sizeof(v)); - } - - - - inline - std::size_t memory_consumption (const std::vector &v) - { - return (v.capacity() * sizeof(double) + - sizeof(v)); - } - - - - inline - std::size_t memory_consumption (const std::vector &v) - { - return (v.capacity() * sizeof(float) + - sizeof(v)); - } - - - - inline - std::size_t memory_consumption (const std::vector &v) - { - return (v.capacity() * sizeof(char) + - sizeof(v)); - } - - - - inline - std::size_t memory_consumption (const std::vector &v) - { - return (v.capacity() * sizeof(unsigned char) + - sizeof(v)); - } - - - - template - inline - std::size_t memory_consumption (const std::vector &v) - { - return (v.capacity() * sizeof(T *) + - sizeof(v)); - } - - - template inline std::size_t memory_consumption (const std::pair &p)