![]() |
SCOREC core
Parallel unstructured mesh tools
|
wrapper over operator new/delete [] More...
Public Member Functions | |
NewArray () | |
default initialize pointer to zero | |
NewArray (std::size_t n) | |
construct with (n) elements | |
~NewArray () | |
Array destructor frees memory. | |
bool | allocated () const |
return true if memory has been allocated | |
void | deallocate () |
user-callable deallocation helper | |
void | allocate (std::size_t n) |
user-callable allocation helper More... | |
![]() | |
Array () | |
default constructor - no allocation | |
Array (unsigned n) | |
construct with n elems | |
Array (Array< T, 0 > const &other) | |
copy constructor | |
~Array () | |
destructor - need to delete elems | |
Array< T, 0 > & | operator= (Array< T, 0 > const &other) |
assignment operator | |
T & | operator[] (unsigned i) |
mutable index operator | |
T const & | operator[] (unsigned i) const |
immutable index operator | |
unsigned | size () const |
get the size of this array | |
void | resize (unsigned n) |
resize the array | |
wrapper over operator new/delete []
this wrapper is used to automatically call delete [] on an array created with new [], preventing memory leaks and forming the base class for other containers. Ideally, all usage of operator new [] should be replaced with this.
Definition at line 27 of file canNewArray.h.
|
inline |
user-callable allocation helper
note that no mix of allocate/deallocate calls can cause a memory leak
Definition at line 48 of file canNewArray.h.