16 #ifndef dealii__memory_consumption_h 17 #define dealii__memory_consumption_h 20 #include <deal.II/base/config.h> 21 #include <deal.II/base/std_cxx11/shared_ptr.h> 22 #include <deal.II/base/std_cxx11/type_traits.h> 23 #include <deal.II/base/std_cxx11/unique_ptr.h> 24 #include <deal.II/base/std_cxx11/array.h> 32 DEAL_II_NAMESPACE_OPEN
101 typename std_cxx11::enable_if<std_cxx11::is_fundamental<T>::value, std::size_t>::type
110 template <
typename T>
112 typename std_cxx11::enable_if<!(std_cxx11::is_fundamental<T>::value || std_cxx11::is_pointer<T>::value), std::size_t>::type
128 template <
typename T>
136 template <
typename T>
174 template <
typename T>
198 template <
typename T, std::
size_t N>
210 template <
typename T,
int N>
228 template <
typename A,
typename B>
251 template <
typename T>
260 template <
typename T>
271 template <
typename T>
273 typename std_cxx11::enable_if<std_cxx11::is_fundamental<T>::value, std::size_t>::type
290 return sizeof(char)*(strlen(
string) + 1);
296 template <
typename T>
300 return sizeof(std::complex<T>);
305 template <
typename T>
317 return sizeof(s) + s.length();
322 template <
typename T>
326 if (std_cxx11::is_fundamental<T>::value || std_cxx11::is_pointer<T>::value)
328 return v.capacity()*
sizeof(T) +
sizeof(v);
332 std::size_t mem =
sizeof(std::vector<T>);
333 for (
unsigned int i=0; i<v.size(); ++i)
337 mem += (v.capacity() - v.size())*
sizeof(T);
344 template <
typename T, std::
size_t N>
348 if (std_cxx11::is_fundamental<T>::value || std_cxx11::is_pointer<T>::value)
355 for (std::size_t i=0; i!=N; ++i)
363 template <
typename T,
int N>
367 for (
unsigned int i=0; i<N; ++i)
377 return v.capacity() / 8 +
sizeof(v);
382 template <
typename A,
typename B>
402 template <
typename T>
407 return sizeof(std_cxx11::shared_ptr<T>);
412 template <
typename T>
417 return sizeof(std_cxx11::unique_ptr<T>);
422 template <
typename T>
424 typename std_cxx11::enable_if<!(std_cxx11::is_fundamental<T>::value || std_cxx11::is_pointer<T>::value), std::size_t>::type
427 return t.memory_consumption();
431 DEAL_II_NAMESPACE_CLOSE
std_cxx11::enable_if< std_cxx11::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)