#include <AutoRefVector.h>
Public Types | |
|
typedef vector< NodeClass * >::value_type | value_type |
| The type of the Node, NodeClass, stored in the vector. | |
|
typedef vector< NodeClass * >::pointer | pointer |
| Pointer to NodeClass. | |
|
typedef vector< NodeClass * >::const_reference | const_reference |
| Const reference to NodeClass. | |
|
typedef vector< NodeClass * >::size_type | size_type |
| An unsigned integral type. | |
|
typedef vector< NodeClass * >::difference_type | difference_type |
| A signed integral type. | |
|
typedef vector< NodeClass * >::const_iterator | const_iterator |
| Const iterator used to iterate through a vector. | |
|
typedef vector< NodeClass * >::const_reverse_iterator | const_reverse_iterator |
| Iterator used to iterate backwards through a vector. | |
Public Member Functions | |
| AutoRefVector () | |
| Creates an empty vector. | |
| AutoRefVector (const vector< NodeClass * > &v) | |
| Copy constructor from a vector class. | |
| AutoRefVector (const AutoRefVector< NodeClass > &v) | |
| Copy constructor. | |
| AutoRefVector (size_type n) | |
| Creates a vector with n elements. | |
| virtual | ~AutoRefVector () |
| Destructor. | |
| AutoRefVector< NodeClass > & | operator= (const AutoRefVector< NodeClass > &v) |
| Assignement operator. | |
| AutoRefVector< NodeClass > & | operator= (const vector< NodeClass * > &v) |
| Assignement operator. | |
| const_iterator | begin () const |
| Returns a const_iterator pointing to the beginning of the vector. | |
| const_iterator | end () const |
| Returns a const_iterator pointing to the end of the vector. | |
| const_reverse_iterator | rbegin () const |
| Returns a const_reverse_iterator pointing to the beginning of the reversed vector. | |
| const_reverse_iterator | rend () const |
| Returns a const_reverse_iterator pointing to the end of the reversed vector. | |
| size_type | size () const |
| Returns the size of the vector. | |
| size_type | max_size () const |
| Returns the largest possible size of the vector. | |
| size_type | capacity () const |
| Number of elements for which memory has been allocated. | |
| void | swap (AutoRefVector< NodeClass > &x) |
| Swaps the contents of two vectors. | |
| void | swap (vector< NodeClass * > &x) |
| Swaps the contents of two vectors. | |
| void | reserve (size_t s) |
| A request for allocation of additional memory. | |
| virtual void | resize (size_t n, NodeClass *t=NULL) |
| Inserts or erases elements at the end such that the size becomes n. | |
| bool | empty () const |
| true if the vector's size is 0. | |
| const_reference | operator[] (size_type n) const |
| Returns the n'th element. | |
| void | set (size_type i, const value_type &v) |
| Set value at index i to v. | |
| const_reference | front () const |
| Returns the first element. | |
| const_reference | back () const |
| Returns the last element. | |
| void | push_back (const value_type &x) |
| Inserts a new element at the end. | |
| void | pop_back () |
| Removed the last element. | |
| void | clear () |
| Erases all of the elements. | |
| virtual void | erase (NodeClass *a) |
| Erase the first element equal to a. | |
Protected Member Functions | |
| virtual void | ref (NodeClass *n) const |
| Virtual function that is called when a Node is added to the vector. | |
| virtual void | unref (NodeClass *n) const |
| Virtual function that is called when a Node is removed to the vector. | |
| void | refAll () const |
| Call ref () on all values in the vector. | |
| void | unrefAll () const |
| Call unref () on all values in the vector. | |
Reference counting will be upheld on all nodes in the vector.
|
|||||||||
|
Number of elements for which memory has been allocated. capacity() is always greater than or equal to size(). |
|
||||||||||
|
Returns the n'th element. We return a const_reference so that the values of the vector only can be changed using member functions. To change the value of a specific index use the set( index, value ) function. |
|
||||||||||
|
A request for allocation of additional memory. If n is less than or equal to capacity(), this call has no effect. Otherwise, it is a request for allocation of additional memory. If the request is successful, then capacity() is greater than or equal to n; otherwise, capacity() is unchanged. In either case, size() is unchanged. |
1.4.5