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 |
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 26 of file canNewArray.h.
void can::NewArray< T >::allocate | ( | std::size_t | n | ) | [inline] |
user-callable allocation helper
note that no mix of allocate/deallocate calls can cause a memory leak
Definition at line 36 of file canNewArray.h.
{return this->elems;}