cocos2d-x
3.3
|
#include <CCVector.h>
Public Types | |
typedef std::vector< T >::iterator | iterator |
typedef std::vector< T > ::const_iterator | const_iterator |
typedef std::vector< T > ::reverse_iterator | reverse_iterator |
typedef std::vector< T > ::const_reverse_iterator | const_reverse_iterator |
Public Member Functions | |
iterator | begin () |
const_iterator | begin () const |
iterator | end () |
const_iterator | end () const |
const_iterator | cbegin () const |
const_iterator | cend () const |
reverse_iterator | rbegin () |
const_reverse_iterator | rbegin () const |
reverse_iterator | rend () |
const_reverse_iterator | rend () const |
const_reverse_iterator | crbegin () const |
const_reverse_iterator | crend () const |
Vector () | |
Constructor. More... | |
Vector (ssize_t capacity) | |
Constructor with a capacity. More... | |
~Vector () | |
Destructor. More... | |
Vector (const Vector< T > &other) | |
Copy constructor. More... | |
Vector (Vector< T > &&other) | |
Move constructor. More... | |
Vector< T > & | operator= (const Vector< T > &other) |
Copy assignment operator. More... | |
Vector< T > & | operator= (Vector< T > &&other) |
Move assignment operator. More... | |
void | reserve (ssize_t n) |
Request a change in capacity. 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... | |
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... | |
const_iterator | find (T object) const |
Find the object in the vector. More... | |
iterator | find (T object) |
T | at (ssize_t index) const |
Returns the element at position 'index' in the vector. More... | |
T | front () const |
Returns the first element in the vector. More... | |
T | back () const |
Returns the last element of the vector. More... | |
T | getRandomObject () const |
Returns a random element of the vector. More... | |
bool | contains (T object) const |
Returns a Boolean value that indicates whether object is present in vector. More... | |
bool | equals (const Vector< T > &other) |
Returns true if the two vectors are equal. More... | |
void | pushBack (T object) |
Adds a new element at the end of the vector, after its current last element. 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 a certain object at a certain index. More... | |
void | popBack () |
Removes the last element in the vector, effectively reducing the container size by one, decrease the referece count of the deleted object. 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 with an 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 two elements. More... | |
void | swap (ssize_t index1, ssize_t index2) |
Swap two elements with certain indexes. More... | |
void | replace (ssize_t index, T object) |
Replace object at index with another object. More... | |
void | reverse () |
reverses the vector More... | |
void | shrinkToFit () |
Shrinks the vector so the memory footprint corresponds with the number of items. More... | |
Protected Member Functions | |
void | addRefForAllObjects () |
Retains all the objects in the vector. More... | |
Protected Attributes | |
std::vector< T > | _data |
typedef std::vector<T>::const_iterator const_iterator |
typedef std::vector<T>::const_reverse_iterator const_reverse_iterator |
typedef std::vector<T>::reverse_iterator reverse_iterator |
|
inline |
Constructor.
|
inline |
Destructor.
|
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 |
|
inline |
|
inline |
Returns the size of the storage space currently allocated for the vector, expressed in terms of elements.
|
inline |
|
inline |
|
inline |
Removes all elements from the vector (which are destroyed), leaving the container with a size of 0.
|
inline |
Returns a Boolean value that indicates whether object is present in vector.
|
inline |
|
inline |
|
inline |
Returns whether the vector is empty (i.e.
whether its size is 0).
|
inline |
|
inline |
|
inline |
Returns true if the two vectors are equal.
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 used, it's only for indicating the end of range. |
Removes from the vector with an index.
index | The index of the element to be removed from the vector. |
|
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.
|
inline |
|
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 a random element of the vector.
|
inline |
Insert a certain object at a certain index.
|
inline |
Returns the maximum number of elements that the vector can hold.
|
inline |
Removes the last element in the vector, effectively reducing the container size by one, decrease the referece count of the deleted object.
|
inline |
Adds a new element at the end of the vector, after its current last element.
|
inline |
Push all elements of an existing vector to the end of current vector.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Replace object at index with another object.
|
inline |
Request a change in capacity.
capacity | Minimum capacity for the vector. If n is greater than the current vector capacity, the function causes the container to reallocate its storage increasing its capacity to n (or greater). |
|
inline |
reverses the vector
|
inline |
Shrinks the vector so the memory footprint corresponds with the number of items.
|
inline |
Returns the number of elements in the vector.
|
inline |
Swap two elements.
|
protected |