#include <CCVector.h>
Public Types | |
typedef std::vector< T >::iterator | iterator |
Iterator, can be used to loop the Vector. More... | |
typedef std::vector< T > ::const_iterator | const_iterator |
Const iterator, can be used to loop the Vector. More... | |
typedef std::vector< T > ::reverse_iterator | reverse_iterator |
Reversed iterator, can be used to loop the Vector in reverse sequence. More... | |
typedef std::vector< T > ::const_reverse_iterator | const_reverse_iterator |
Reversed iterator, can be used to loop the Vector in reverse sequence. More... | |
Public Member Functions | |
iterator | begin () |
Returns an iterator pointing the first element of the Vector. More... | |
var | begin () |
Returns an iterator pointing the first element of the Vector. More... | |
const_iterator | begin () const |
Returns an iterator pointing the first element of the Vector. More... | |
var | begin () |
Returns an iterator pointing the first element of the Vector. More... | |
iterator | end () |
Returns an iterator referring to the past-the-end element in the Vector container. More... | |
const_iterator | end () const |
Returns iterator referring to the past-the-end element in the Vector container. More... | |
const_iterator | cbegin () const |
Returns a const_iterator pointing the first element of the Vector. More... | |
const_iterator | cend () const |
Returns a const_iterator pointing the past-the-end element of the Vector. More... | |
var | cend () |
Returns a const_iterator pointing the past-the-end element of the Vector. More... | |
reverse_iterator | rbegin () |
Returns a reverse iterator pointing to the last element of the Vector. More... | |
const_reverse_iterator | rbegin () const |
Returns a reverse iterator pointing to the last element of the Vector. More... | |
reverse_iterator | rend () |
Returns a reverse iterator pointing to the theoretical element preceding the first element of the vector (which is considered its reverse end). More... | |
const_reverse_iterator | rend () const |
Returns a reverse iterator pointing to the theoretical element preceding the first element of the vector (which is considered its reverse end). More... | |
const_reverse_iterator | crbegin () const |
Returns a const_reverse_iterator pointing to the last element in the container (i.e., its reverse beginning). More... | |
const_reverse_iterator | crend () const |
Returns a const_reverse_iterator pointing to the theoretical element preceding the first element in the container (which is considered its reverse end). More... | |
Vector () | |
Constructor. More... | |
Vector () | |
Constructor. More... | |
Vector (ssize_t capacity) | |
Constructor with a capacity. More... | |
Vector ( var capacity) | |
Constructor with a capacity. More... | |
~Vector () | |
Destructor. More... | |
~Vector () | |
Destructor. More... | |
Vector (const Vector< T > &other) | |
Copy constructor. More... | |
Vector ( var other) | |
Copy constructor. More... | |
Vector (Vector< T > &&other) | |
Constructor with std::move semantic. More... | |
Vector< T > & | operator= (const Vector< T > &other) |
Copy assignment operator. More... | |
var | operator= ( var other) |
Copy assignment operator. More... | |
Vector< T > & | operator= (Vector< T > &&other) |
Copy assignment operator with std::move semantic. More... | |
var | operator= ( var other) |
Copy assignment operator with std::move semantic. More... | |
void | reserve (ssize_t n) |
Requests that the vector capacity be at least enough to contain n elements. More... | |
ssize_t | capacity () const |
Returns the size of the storage space currently allocated for the Vector, expressed in terms of elements. More... | |
ssize_t | size () const |
Returns the number of elements in the Vector. More... | |
bool | empty () const |
Returns whether the Vector is empty (i.e. More... | |
var | empty () |
Returns whether the Vector is empty (i.e. More... | |
ssize_t | max_size () const |
Returns the maximum number of elements that the Vector can hold. More... | |
ssize_t | getIndex (T object) const |
Returns index of a certain object, return UINT_MAX if doesn't contain the object. More... | |
var | getIndex ( var object) |
Returns index of a certain object, return UINT_MAX if doesn't contain the object. More... | |
const_iterator | find (T object) const |
Find the object in the Vector. More... | |
iterator | find (T object) |
Find the object in the Vector. More... | |
var | find ( var object) |
Find the object in the Vector. More... | |
T | at (ssize_t index) const |
Returns the element at position 'index' in the Vector. More... | |
var | at ( var index) |
Returns the element at position 'index' in the Vector. More... | |
T | front () const |
Returns the first element in the Vector. More... | |
var | front () |
Returns the first element in the Vector. More... | |
T | back () const |
Returns the last element of the Vector. More... | |
var | back () |
Returns the last element of the Vector. More... | |
T | getRandomObject () const |
Returns a random element of the Vector. More... | |
var | getRandomObject () |
Returns a random element of the Vector. More... | |
bool | contains (T object) const |
Checks whether an object is in the container. More... | |
var | contains ( var object) |
Checks whether an object is in the container. More... | |
bool | equals (const Vector< T > &other) |
Checks whether two vectors are equal. More... | |
void | pushBack (T object) |
Adds a new element at the end of the Vector. More... | |
void | pushBack (const Vector< T > &other) |
Push all elements of an existing Vector to the end of current Vector. More... | |
void | insert (ssize_t index, T object) |
Insert an object at certain index. More... | |
var | insert ( var index, var object) |
Insert an object at certain index. More... | |
void | popBack () |
Removes the last element in the Vector. More... | |
var | popBack () |
Removes the last element in the Vector. More... | |
void | eraseObject (T object, bool removeAll=false) |
Remove a certain object in Vector. More... | |
iterator | erase (iterator position) |
Removes from the vector with an iterator. More... | |
iterator | erase (iterator first, iterator last) |
Removes from the Vector with a range of elements ( [first, last) ). More... | |
iterator | erase (ssize_t index) |
Removes from the Vector by index. More... | |
var | erase ( var index) |
Removes from the Vector by index. More... | |
void | clear () |
Removes all elements from the Vector (which are destroyed), leaving the container with a size of 0. More... | |
void | swap (T object1, T object2) |
Swap the values object1 and object2. More... | |
var | swap ( var object1, var object2) |
Swap the values object1 and object2. More... | |
void | swap (ssize_t index1, ssize_t index2) |
Swap two elements by indexes. More... | |
var | swap ( var index1, var index2) |
Swap two elements by indexes. More... | |
void | replace (ssize_t index, T object) |
Replace value at index with given object. More... | |
var | replace ( var index, var object) |
Replace value at index with given object. More... | |
void | reverse () |
Reverses the Vector. More... | |
void | shrinkToFit () |
Requests the container to reduce its capacity to fit its size. More... | |
var | shrinkToFit () |
Requests the container to reduce its capacity to fit its size. More... | |
Protected Member Functions | |
void | addRefForAllObjects () |
Retains all the objects in the vector. More... | |
var | addRefForAllObjects () |
Retains all the objects in the vector. More... | |
Protected Attributes | |
std::vector< T > | _data |
typedef std::vector<T> ::const_iterator const_iterator |
Const iterator, can be used to loop the Vector.
var const_iterator |
Const iterator, can be used to loop the Vector.
typedef std::vector<T> ::const_reverse_iterator const_reverse_iterator |
Reversed iterator, can be used to loop the Vector in reverse sequence.
Reversed iterator, can be used to loop the Vector in reverse sequence.
typedef std::vector<T> ::reverse_iterator reverse_iterator |
Reversed iterator, can be used to loop the Vector in reverse sequence.
var reverse_iterator |
Reversed iterator, can be used to loop the Vector in reverse sequence.
|
inline |
Constructor.
|
inline |
Constructor.
Constructor with a capacity.
capacity | Capacity of the Vector. |
|
inlineexplicit |
Constructor with a capacity.
capacity | Capacity of the Vector. |
|
inline |
Destructor.
|
inline |
Destructor.
|
inline |
Copy constructor.
|
inline |
Constructor with std::move semantic.
|
inlineprotected |
Retains all the objects in the vector.
|
inlineprotected |
Retains all the objects in the vector.
|
inline |
Returns the element at position 'index' in the Vector.
|
inline |
Returns the last element of the Vector.
|
inline |
Returns the last element of the Vector.
|
inline |
Returns an iterator pointing the first element of the Vector.
|
inline |
Returns an iterator pointing the first element of the Vector.
|
inline |
Returns an iterator pointing the first element of the Vector.
|
inline |
Returns the size of the storage space currently allocated for the Vector, expressed in terms of elements.
|
inline |
Returns the size of the storage space currently allocated for the Vector, expressed in terms of elements.
|
inline |
Returns a const_iterator pointing the first element of the Vector.
|
inline |
Returns a const_iterator pointing the first element of the Vector.
|
inline |
Returns a const_iterator pointing the past-the-end
element of the Vector.
|
inline |
Returns a const_iterator pointing the past-the-end
element of the Vector.
|
inline |
|
inline |
|
inline |
Checks whether an object is in the container.
object | The object to be checked. |
|
inline |
Checks whether an object is in the container.
object | The object to be checked. |
|
inline |
Returns a const_reverse_iterator pointing to the last element in the container (i.e., its reverse beginning).
|
inline |
Returns a const_reverse_iterator pointing to the last element in the container (i.e., its reverse beginning).
|
inline |
Returns a const_reverse_iterator pointing to the theoretical element preceding the first element in the container (which is considered its reverse end).
|
inline |
Returns a const_reverse_iterator pointing to the theoretical element preceding the first element in the container (which is considered its reverse end).
|
inline |
Returns whether the Vector is empty (i.e.
whether its size is 0).
|
inline |
Returns whether the Vector is empty (i.e.
whether its size is 0).
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Checks whether two vectors are equal.
other | The vector to be compared. |
|
inline |
Checks whether two vectors are equal.
other | The vector to be compared. |
Removes from the vector with an iterator.
position | Iterator pointing to a single element to be removed from the Vector. |
|
inline |
Removes from the vector with an iterator.
position | Iterator pointing to a single element to be removed from the Vector. |
Removes from the Vector with a range of elements ( [first, last) ).
first | The beginning of the range. |
last | The end of the range, the 'last' will not be removed, it's only for indicating the end of range. |
|
inline |
Removes from the Vector with a range of elements ( [first, last) ).
first | The beginning of the range. |
last | The end of the range, the 'last' will not be removed, it's only for indicating the end of range. |
|
inline |
|
inline |
Remove a certain object in Vector.
object | The object to be removed. |
removeAll | Whether to remove all elements with the same value. If its value is 'false', it will just erase the first occurrence. |
|
inline |
Remove a certain object in Vector.
object | The object to be removed. |
removeAll | Whether to remove all elements with the same value. If its value is 'false', it will just erase the first occurrence. |
|
inline |
Find the object in the Vector.
object | The object to find. |
|
inline |
Find the object in the Vector.
object | The object to find. |
|
inline |
Find the object in the Vector.
object | The object to find. |
|
inline |
Find the object in the Vector.
object | The object to find. |
|
inline |
Returns the first element in the Vector.
|
inline |
Returns the first element in the Vector.
|
inline |
Returns index of a certain object, return UINT_MAX if doesn't contain the object.
|
inline |
Returns index of a certain object, return UINT_MAX if doesn't contain the object.
|
inline |
Returns a random element of the Vector.
|
inline |
Returns a random element of the Vector.
|
inline |
Insert an object at certain index.
index | The index to be inserted at. |
object | The object to be inserted. |
|
inline |
Insert an object at certain index.
index | The index to be inserted at. |
object | The object to be inserted. |
|
inline |
Returns the maximum number of elements that the Vector can hold.
|
inline |
Copy assignment operator.
Copy assignment operator with std::move semantic.
|
inline |
Copy assignment operator with std::move semantic.
|
inline |
Removes the last element in the Vector.
|
inline |
Removes the last element in the Vector.
|
inline |
Adds a new element at the end of the Vector.
|
inline |
Adds a new element at the end of the Vector.
|
inline |
|
inline |
|
inline |
Returns a reverse iterator pointing to the last element of the Vector.
|
inline |
Returns a reverse iterator pointing to the last element of the Vector.
|
inline |
Returns a reverse iterator pointing to the last element of the Vector.
|
inline |
Returns a reverse iterator pointing to the last element of the Vector.
|
inline |
Returns a reverse iterator pointing to the theoretical element preceding the first element of the vector (which is considered its reverse end).
|
inline |
Returns a reverse iterator pointing to the theoretical element preceding the first element of the vector (which is considered its reverse end).
|
inline |
Returns a reverse iterator pointing to the theoretical element preceding the first element of the vector (which is considered its reverse end).
|
inline |
Returns a reverse iterator pointing to the theoretical element preceding the first element of the vector (which is considered its reverse end).
|
inline |
Replace value at index with given object.
|
inline |
Replace value at index with given object.
|
inline |
Requests that the vector capacity be at least enough to contain n elements.
capacity | Minimum capacity requested of the Vector. |
|
inline |
Requests that the vector capacity be at least enough to contain n elements.
capacity | Minimum capacity requested of the Vector. |
|
inline |
Reverses the Vector.
|
inline |
Reverses the Vector.
|
inline |
Requests the container to reduce its capacity to fit its size.
|
inline |
Requests the container to reduce its capacity to fit its size.
|
inline |
|
inline |
|
inline |
Swap the values object1 and object2.
|
inline |
Swap the values object1 and object2.
|
inline |
Swap two elements by indexes.
|
protected |
|
protected |