libcommonc++
0.7
|
A simple object wrapper for dynamically-allocated arrays. More...
#include <DynamicArray.h++>
Public Types | |
typedef T | value_type |
typedef T * | iterator |
typedef const T * | const_iterator |
typedef T & | reference |
typedef const T & | const_reference |
Public Member Functions | |
DynamicArray (uint_t size) | |
Construct a new DynamicArray with the given initial size. More... | |
~DynamicArray () | |
Destructor. More... | |
void | resize (uint_t size, bool copy=false) |
Resize the array to a new size. More... | |
T * | release () |
Release ownership of the array. More... | |
bool | isNull () const |
Determine if this array is NULL. More... | |
T * | data () |
Get the underlying array. More... | |
const T * | data () const |
Get the underlying array. More... | |
uint_t | size () const |
Get the size of the array. More... | |
T & | operator[] (int index) |
Index operator. More... | |
T | operator[] (int index) const |
Index operator. More... | |
operator T* () | |
Cast operator. More... | |
operator const T * () const | |
Cast operator. More... | |
bool | operator! () const |
Unary NOT operator. More... | |
iterator | begin () |
const_iterator | begin () const |
iterator | end () |
const_iterator | end () const |
A simple object wrapper for dynamically-allocated arrays.
See section 17.5.4 of The C++ Programming Language. The array is heap-allocated and can be resized after construction. An array of length zero is considered to be "null".
typedef const T* const_iterator |
typedef const T& const_reference |
typedef T* iterator |
typedef T& reference |
typedef T value_type |
|
inline |
Construct a new DynamicArray with the given initial size.
size | The initial size, as a number of elements. |
|
inline |
Destructor.
|
inline |
|
inline |
|
inline |
Get the underlying array.
|
inline |
Get the underlying array.
|
inline |
|
inline |
|
inline |
Determine if this array is NULL.
|
inline |
Cast operator.
|
inline |
Cast operator.
|
inline |
Unary NOT operator.
|
inline |
Index operator.
OutOfBoundsException | If the index is invalid. |
|
inline |
Index operator.
OutOfBoundsException | If the index is invalid. |
|
inline |
Release ownership of the array.
|
inline |
Resize the array to a new size.
Allocates a new array, and optionally copies as many elements from the old array as will fit to the new one.
size | The new size, as a number of elements. |
copy | If true, copy the elements from the old array. |
|
inline |
Get the size of the array.