MongoDB C++ Driver
legacy-1.1.2
|
An std::vector wrapper that deletes pointers within a vector on destruction. More...
#include <owned_pointer_vector.h>
Public Member Functions | |
OwnedPointerVector (std::vector< T * > other) | |
Takes ownership of all pointers contained in 'other'. More... | |
OwnedPointerVector & | operator= (std::vector< T * > other) |
Takes ownership of all pointers contained in 'other'. More... | |
const std::vector< T * > & | vector () const |
Access the vector. More... | |
void | clear () |
Deletes all pointers in the vector, then sets its size to 0. | |
void | erase (const_iterator it) |
Deletes the pointer at 'it', then erases it from the vector. | |
std::vector< T * > | release () |
Releases the entire vector to allow you to transfer ownership. More... | |
T * | releaseAt (size_t i) |
Releases ownership of a single element. More... | |
An std::vector wrapper that deletes pointers within a vector on destruction.
The objects referenced by the vector's pointers are 'owned' by an object of this class. NOTE that an OwnedPointerVector<T> wraps an std::vector<T*>.
|
inline |
Takes ownership of all pointers contained in 'other'.
NOTE: argument is intentionally taken by value.
|
inline |
Takes ownership of all pointers contained in 'other'.
NOTE: argument is intentionally taken by value.
|
inline |
Releases the entire vector to allow you to transfer ownership.
Leaves the OwnedPointerVector empty. Named after the similar method and pattern in std::auto_ptr.
|
inline |
Releases ownership of a single element.
Sets that element to NULL and does not change size().
|
inline |
Access the vector.