Public Member Functions

can::NewArray< T > Class Template Reference

wrapper over operator new/delete [] More...

Inheritance diagram for can::NewArray< T >:
can::Array< T, 0 >

List of all members.

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

Detailed Description

template<class T>
class can::NewArray< T >

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.


Member Function Documentation

template<class T>
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


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines