16 #ifndef dealii_memory_consumption_h 17 #define dealii_memory_consumption_h 20 #include <deal.II/base/config.h> 28 #include <type_traits> 31 DEAL_II_NAMESPACE_OPEN
101 typename std::enable_if<std::is_fundamental<T>::value, std::size_t>::type
110 template <
typename T>
111 inline typename std::enable_if<!(std::is_fundamental<T>::value ||
112 std::is_pointer<T>::value),
129 template <
typename T>
137 template <
typename T>
175 template <
typename T>
199 template <
typename T, std::
size_t N>
211 template <
typename T,
int N>
229 template <
typename A,
typename B>
242 template <
typename T>
251 template <
typename T>
260 template <
typename T>
271 template <
typename T>
273 typename std::enable_if<std::is_fundamental<T>::value, std::size_t>::type
284 if (
string ==
nullptr)
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>
327 if (std::is_fundamental<T>::value || std::is_pointer<T>::value)
329 return v.capacity() *
sizeof(T) +
sizeof(v);
333 std::size_t mem =
sizeof(std::vector<T>);
334 for (
unsigned int i = 0; i < v.size(); ++i)
338 mem += (v.capacity() - v.size()) *
sizeof(T);
345 template <
typename T, std::
size_t N>
350 if (std::is_fundamental<T>::value || std::is_pointer<T>::value)
357 for (std::size_t i = 0; i != N; ++i)
365 template <
typename T,
int N>
370 for (
unsigned int i = 0; i < N; ++i)
380 return v.capacity() / 8 +
sizeof(v);
385 template <
typename A,
typename B>
394 template <
typename T>
403 template <
typename T>
407 return sizeof(std::shared_ptr<T>);
412 template <
typename T>
416 return sizeof(std::unique_ptr<T>);
421 template <
typename T>
422 inline typename std::enable_if<!(std::is_fundamental<T>::value ||
423 std::is_pointer<T>::value),
427 return t.memory_consumption();
431 DEAL_II_NAMESPACE_CLOSE
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)