![]() | InDesign SDK 20.5 |
#include <K2SmartPtr.h>

Public Types | |
| typedef T | element_type |
Public Member Functions | |
| scoped_array (T *p=0) | |
| ~scoped_array () | |
| void | reset (T *p=0) |
| T * | get () const |
| T * | release () |
| T & | operator[] (std::size_t i) const |
scoped_array extends scoped_ptr to arrays. Deletion of the array pointed to is guaranteed, either on destruction of the scoped_array or via an explicit reset(). See shared_array or std::vector if your needs are more complex.
Notes:
| inlineexplicit |
Constructs a scoped_array, storing a copy of p which MUST have been allocated using the operator new[] (or must be nil).
| inline |
Deletes the array pointed by the stored pointer. Note that a delete[] on a nil pointer is harmless.
| inline |
Gets the stored pointer.
| inline |
Subscript operator. Returns the element at the specified position in the array. Behavior is undefined and almost certainly undesirable if the stored pointer is nil, or if i is less than 0 or is greater than or equal to the number of elements in the array.
| i | [IN] - index in the array of the element. |
| inline |
Detaches from the stored pointer by transferring the ownership to the caller. Note: the signature of this method is error prone because it allows the caller to lose the resource by not assign it to anything.
| inline |
Deletes the array pointed by the stored pointer and then re-assigns it to the new value.