Template Class Malloc

Class Documentation

template<typename T>
class Utils::Malloc

Class manafin memory allocation.

Public Types

typedef T valueType

Public Functions

explicit Malloc(string const &name)

Malloc object constructor

inline ~Malloc()

Malloc object destructor.

void allocate(size_t n)

Allocate memory for n objects, raise an error if memory already allocated.

void reallocate(size_t n)

Allocate memory for n objects, no matter if already allocated.

inline void free(void)

Free memory without deallocating pointer.

void hard_free(void)

Free memory deallocating pointer.

inline size_t size(void) const

Number of objects allocated.

inline T *operator()(size_t sz)

Get pointer of allocated memory for sz objets.

T *malloc(size_t n)
T *realloc(size_t n)
inline bool is_empty() const

true if you cannot get more memory pointers.

void must_be_empty(char const *const where) const

return an error if memory is not completely used.