Serial-TCP/IPbridge
1.0
|
Limited version of std::auto_ptr for dynamic arrays. More...
#include <auto_array.h>
Public Member Functions | |
auto_array (T *p=0) throw () | |
Constructs an auto_array object from an array pointer. More... | |
~auto_array () throw () | |
Deallocates the block of memory the object "points to" using delete[] and destructs the object. More... | |
T * | get () const throw () |
Returns the stored pointer. More... | |
T * | release () throw () |
Returns the stored pointer and sets the internal pointer to 0. More... | |
void | reset (T *p=0) throw () |
Deallocates the array that the auto_array points to and sets a new value. More... | |
Private Member Functions | |
auto_array (auto_array &a) throw () | |
template<class Y > | |
auto_array (auto_array< Y > &a) throw () | |
T & | operator* () const throw () |
T * | operator-> () const throw () |
auto_array & | operator= (auto_array &a) throw () |
template<class Y > | |
auto_array & | operator= (auto_array< Y > &a) throw () |
template<class Y > | |
operator auto_array< Y > () throw () | |
Private Attributes | |
T * | _p |
Stored pointer. More... | |
Limited version of std::auto_ptr for dynamic arrays.
As you know, one cannot use std::auto_ptr for storing dynamic arrays because std::auto_ptr calls delete instead of delete[] in its destructor. This version provides the same functinality for dynamic arrays.
|
inlineexplicit |
Constructs an auto_array object from an array pointer.
p | Pointer to a dynamically allocated array. If this parameter is 0 the auto_array is a null pointer (points to nowhere). |
|
inline |
Deallocates the block of memory the object "points to" using delete[] and destructs the object.
References auto_array< T >::_p.
|
private |
|
private |
|
inline |
Returns the stored pointer.
References auto_array< T >::_p.
|
private |
|
private |
|
private |
|
private |
|
private |
|
inline |
Returns the stored pointer and sets the internal pointer to 0.
Sets the auto_array internal pointer to null pointer (which indicates it points to no array) without destructing the array currently pointed by the auto_array.
References auto_array< T >::_p.
|
inline |
Deallocates the array that the auto_array points to and sets a new value.
Destructs the array pointed by the auto_array object, if any, and deallocates its memory (by calling operator delete[]). If a value for p is specified, the internal pointer is initialized to that value (otherwise it is set to the null pointer).
References auto_array< T >::_p.
|
private |
Stored pointer.
Referenced by auto_array< T >::get(), auto_array< T >::release(), auto_array< T >::reset(), and auto_array< T >::~auto_array().