#include <ncutMemory.h>
Public Types | |
typedef _Tp | element_type |
The pointed-to type. | |
Public Member Functions | |
auto_array (element_type *__p=0) throw () | |
An auto_array is usually constructed from a raw array. | |
auto_array (auto_array &__a) throw () | |
An auto_array can be constructed from another auto_array. | |
template<typename _Tp1> | |
auto_array (auto_array< _Tp1 > &__a) throw () | |
An auto_array can be constructed from another auto_array. | |
auto_array & | operator= (auto_array &__a) throw () |
auto_array assignment operator. | |
template<typename _Tp1> | |
auto_array & | operator= (auto_array< _Tp1 > &__a) throw () |
auto_array assignment operator. | |
~auto_array () | |
element_type & | operator[] (unsigned int i) const throw () |
Smart array element access. | |
element_type & | operator * () const throw () |
Smart array dereferencing. | |
element_type * | operator-> () const throw () |
Smart array dereferencing. | |
element_type * | get () const throw () |
Bypassing the smart array. | |
element_type * | release () throw () |
Bypassing the smart array. | |
void | reset (element_type *__p=0) throw () |
Forcibly deletes the managed array. | |
auto_array (auto_array_ref< element_type > __ref) throw () | |
Automatic conversions. | |
auto_array & | operator= (auto_array_ref< element_type > __ref) throw () |
template<typename _Tp1> | |
operator auto_array_ref () throw () | |
template<typename _Tp1> | |
operator auto_array () throw () |
An auto_array
owns the array it holds a pointer to. Copying an auto_array
copies the pointer and transfers ownership to the destination. If more than one auto_array
owns the same array at the same time the behavior of the program is undefined.
The uses of auto_array
include providing temporary exception-safety for dynamically allocated memory, passing ownership of dynamically allocated memory to a function, and returning dynamically allocated memory from a function. auto_array
does not meet the CopyConstructible and Assignable requirements for Standard Library container elements and thus instantiating a Standard Library container with an auto_array
results in undefined behavior.
|
An auto_array is usually constructed from a raw array.
|
|
An auto_array can be constructed from another auto_array.
|
|
An auto_array can be constructed from another auto_array.
This object now owns the object previously owned by a, which has given up ownsership. |
|
When the auto_array goes out of scope, the object it owns is deleted. If it no longer owns anything (i.e., The C++ standard says there is supposed to be an empty throw specification here, but omitting it is standard conforming. Its presence can be detected only if _Tp::~_Tp() throws, but this is prohibited. [17.4.3.6]/2 |
|
Automatic conversions. These operations convert an auto_array into and from an auto_arary_ref automatically as needed. This allows constructs such as auto_array<Derived> func_returning_auto_array(.....); ... auto_array<Base> ptr = func_returning_auto_array(.....); |
|
Bypassing the smart array.
|
|
Smart array dereferencing. If this auto_array no longer owns anything, then this operation will crash. (For a smart pointer, "no longer owns anything" is the same as being a null pointer, and you know what happens when you dereference one of those...) |
|
Smart array dereferencing. This returns the pointer itself, which the language then will automatically cause to be dereferenced. |
|
auto_array assignment operator.
This object now owns the object previously owned by a, which has given up ownsership. The object that this one used to own and track has been deleted. |
|
auto_array assignment operator.
|
|
Smart array element access. If this auto_array no longer owns anything, then this operation will crash. (For a smart pointer, "no longer owns anything" is the same as being a null pointer, and you know what happens when you dereference one of those...) |
|
Bypassing the smart array.
|
|
Forcibly deletes the managed array.
|