SyTen
memory_size.h File Reference

Memory size informational functions. More...

#include <cstdlib>
#include <type_traits>
#include <vector>
#include <array>
#include <utility>
#include <string>
#include <unordered_map>
#include <map>
#include <variant>
+ Include dependency graph for memory_size.h:
+ This graph shows which files directly or indirectly include this file:

Classes

struct  syten::MemoryUsage::AllocSize< T, U >
 AllocSize default implementation: Returns zero always. More...
 
struct  syten::MemoryUsage::AllocSize< std::array< T, num >, MemorySize >
 AllocSize() specialisation for std::array. More...
 
struct  syten::MemoryUsage::AllocSize< std::map< Key, Value >, MemorySize >
 AllocSize() specialisation for std::map. More...
 
struct  syten::MemoryUsage::AllocSize< std::pair< T, U >, MemorySize >
 AllocSize() specialisation for std::pair. More...
 
struct  syten::MemoryUsage::AllocSize< std::string, MemorySize >
 AllocSize() specialisation for std::string. More...
 
struct  syten::MemoryUsage::AllocSize< std::unordered_map< Key, Value >, MemorySize >
 AllocSize() specialisation for std::map. More...
 
struct  syten::MemoryUsage::AllocSize< std::variant< Types... >, MemorySize >
 AllocSize() specialisation for std::variant. More...
 
struct  syten::MemoryUsage::AllocSize< std::vector< T >, MemorySize >
 AllocSize() specialisation for std::vector. More...
 
struct  syten::MemoryUsage::AllocSize< T, decltype(std::declval< T >().allocSize())>
 AllocSize specialisation if the member function T::allocSize() exists. More...
 
struct  syten::MemoryUsage::MemorySize
 A certain number of bytes, a simple wrapper around std::size_t. More...
 
struct  syten::MemoryUsage::StackSize< T, U >
 StackSize default implementation: Returns sizeof(T). More...
 
struct  syten::MemoryUsage::StackSize< T, decltype(std::declval< T >().stackSize())>
 StackSize specialisation if the member function T::stackSize() exists. More...
 
struct  syten::MemoryUsage::TotalSize< T, U >
 TotalSize default implementation: Returns stackSize(obj) + allocSize(obj). More...
 
struct  syten::MemoryUsage::TotalSize< T, decltype(std::declval< T >().totalSize())>
 TotalSize specialisation if the member function T::totalSize() exists. More...
 

Namespaces

namespace  syten
 Syten namespace.
 
namespace  syten::MemoryUsage
 Memory usage reporting with allocSize(), totalSize() and stackSize()
 

Functions

template<typename T >
constexpr MemorySize syten::MemoryUsage::allocSize (T const &obj)
 Returns the amount of memory dynamically allocated by obj and its children. More...
 
std::ostreamsyten::MemoryUsage::operator<< (std::ostream &out, MemorySize value)
 Pretty-prints a MemorySize object. More...
 
template<typename T >
constexpr MemorySize syten::MemoryUsage::stackSize (T const &obj)
 Returns the amount of stack memory required by obj and its members. More...
 
template<typename T >
constexpr MemorySize syten::MemoryUsage::totalSize (T const &obj)
 Returns the amount of total memory required by obj and its members. More...
 

Detailed Description

Memory size informational functions.