Hex  1.0
Hydrogen-electron collision solver
 All Data Structures Namespaces Files Functions Variables Typedefs Macros Pages
Static Public Member Functions
PlainAllocator< T > Class Template Reference

Basic memory allocator. More...

#include <arrays.h>

Static Public Member Functions

static T * alloc (size_t n)
 Allocate array. More...
 
static void free (T *ptr)
 Free array. More...
 

Detailed Description

template<class T>
class PlainAllocator< T >

Memory allocators are used by Array -like classes for memory management: allocating and freeing of memory. PlainAllocator uses the usual C++ "new/delete" mechanism for manipulation of the memory.

Member Function Documentation

template<class T >
static T* PlainAllocator< T >::alloc ( size_t  n)
inlinestatic

This method will allocate fields of the data type T. The elements will be constructed by the implicit constructor.

Parameters
nNumber of items to allocate.
template<class T >
static void PlainAllocator< T >::free ( T *  ptr)
inlinestatic

This method will deallocate memory pointed to by the pointer "ptr". It is expected that pointer has been previously retrieved from the function PlainAllocator::alloc. The pointer can have the value "nullptr"; in such a case nothing will be done.


The documentation for this class was generated from the following file: