16 #ifndef dealii_memory_consumption_h 17 #define dealii_memory_consumption_h 20 #include <deal.II/base/config.h> 29 #include <type_traits> 31 DEAL_II_NAMESPACE_OPEN
100 typename std::enable_if<std::is_fundamental<T>::value, std::size_t>::type
109 template <
typename T>
111 typename std::enable_if<!(std::is_fundamental<T>::value || std::is_pointer<T>::value), std::size_t>::type
127 template <
typename T>
135 template <
typename T>
173 template <
typename T>
197 template <
typename T, std::
size_t N>
209 template <
typename T,
int N>
227 template <
typename A,
typename B>
240 template <
typename T>
250 template <
typename T>
259 template <
typename T>
270 template <
typename T>
272 typename std::enable_if<std::is_fundamental<T>::value, std::size_t>::type
283 if (
string ==
nullptr)
289 return sizeof(char)*(strlen(
string) + 1);
295 template <
typename T>
299 return sizeof(std::complex<T>);
304 template <
typename T>
316 return sizeof(s) + s.length();
321 template <
typename T>
325 if (std::is_fundamental<T>::value || std::is_pointer<T>::value)
327 return v.capacity()*
sizeof(T) +
sizeof(v);
331 std::size_t mem =
sizeof(std::vector<T>);
332 for (
unsigned int i=0; i<v.size(); ++i)
336 mem += (v.capacity() - v.size())*
sizeof(T);
343 template <
typename T, std::
size_t N>
347 if (std::is_fundamental<T>::value || std::is_pointer<T>::value)
354 for (std::size_t i=0; i!=N; ++i)
362 template <
typename T,
int N>
366 for (
unsigned int i=0; i<N; ++i)
376 return v.capacity() / 8 +
sizeof(v);
381 template <
typename A,
typename B>
391 template <
typename T>
401 template <
typename T>
406 return sizeof(std::shared_ptr<T>);
411 template <
typename T>
416 return sizeof(std::unique_ptr<T>);
421 template <
typename T>
423 typename std::enable_if<!(std::is_fundamental<T>::value || std::is_pointer<T>::value), std::size_t>::type
426 return t.memory_consumption();
430 DEAL_II_NAMESPACE_CLOSE
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)