- 首页
- 相关页面
- 模块
- 命名空间
- 类
- 文件
-
)
- 类列表
- 类索引
- 类继承关系
- 类成员
全部) 类) 命名空间) 文件) 函数) 变量) 类型定义) 枚举) 枚举值) 属性) 友元) 宏定义) 组) 页)
Public 类型 | Public 成员函数 | Protected 成员函数 | Protected 属性 | 所有成员列表
Vector< T > 模板类 参考
#include
## Public 成员函数
|
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. 更多…
|
|
| Vector (ssize_t capacity) |
| Constructor with a capacity. 更多…
|
|
| ~Vector () |
| Destructor. 更多…
|
|
| Vector (const Vector< T > &other) |
| Copy constructor. 更多…
|
|
| Vector (Vector< T > &&other) |
| Move constructor. 更多…
|
|
Vector< T > & | operator= (const Vector< T > &other) |
| Copy assignment operator. 更多…
|
|
Vector< T > & | operator= (Vector< T > &&other) |
| Move assignment operator. 更多…
|
|
void | reserve (ssize_t n) |
| Request a change in capacity. 更多…
|
|
ssize_t | capacity () const |
| Returns the size of the storage space currently allocated for the vector, expressed in terms of elements. 更多…
|
|
ssize_t | size () const |
| Returns the number of elements in the vector. 更多…
|
|
bool | empty () const |
| Returns whether the vector is empty (i.e. 更多…
|
|
ssize_t | max_size () const |
| Returns the maximum number of elements that the vector can hold. 更多…
|
|
ssize_t | getIndex (T object) const |
| Returns index of a certain object, return UINT_MAX if doesn't contain the object. 更多…
|
|
const_iterator | find (T object) const |
| Find the object in the vector. 更多…
|
|
iterator | find (T object) |
|
T | at (ssize_t index) const |
| Returns the element at position 'index' in the vector. 更多…
|
|
T | front () const |
| Returns the first element in the vector. 更多…
|
|
T | back () const |
| Returns the last element of the vector. 更多…
|
|
T | getRandomObject () const |
| Returns a random element of the vector. 更多…
|
|
bool | contains (T object) const |
| Returns a Boolean value that indicates whether object is present in vector. 更多…
|
|
bool | equals (const Vector< T > &other) |
| Returns true if the two vectors are equal. 更多…
|
|
void | pushBack (T object) |
| Adds a new element at the end of the vector, after its current last element. 更多…
|
|
void | pushBack (const Vector< T > &other) |
| Push all elements of an existing vector to the end of current vector. 更多…
|
|
void | insert (ssize_t index, T object) |
| Insert a certain object at a certain index. 更多…
|
|
void | popBack () |
| Removes the last element in the vector, effectively reducing the container size by one, decrease the referece count of the deleted object. 更多…
|
|
void | eraseObject (T object, bool removeAll=false) |
| Remove a certain object in Vector. 更多…
|
|
iterator | erase (iterator position) |
| Removes from the vector with an iterator. 更多…
|
|
iterator | erase (iterator first, iterator last) |
| Removes from the vector with a range of elements ( [first, last) ). 更多…
|
|
iterator | erase (ssize_t index) |
| Removes from the vector with an index. 更多…
|
|
void | clear () |
| Removes all elements from the vector (which are destroyed), leaving the container with a size of 0. 更多…
|
|
void | swap (T object1, T object2) |
| Swap two elements. 更多…
|
|
void | swap (ssize_t index1, ssize_t index2) |
| Swap two elements with certain indexes. 更多…
|
|
void | replace (ssize_t index, T object) |
| Replace object at index with another object. 更多…
|
|
void | reverse () |
| reverses the vector 更多…
|
|
void | shrinkToFit () |
| Shrinks the vector so the memory footprint corresponds with the number of items. 更多…
|
|
## Protected 属性
|
std::vector< T > | _data |
|
成员类型定义说明
构造及析构函数说明
Constructor.
Constructor with a capacity.
Destructor.
Copy constructor.
Move constructor.
成员函数说明
void addRefForAllObjects | ( | | ) | |
| inlineprotected |
Retains all the objects in the vector.
Returns the element at position 'index' in the vector.
Returns the last element of the vector.
Returns the size of the storage space currently allocated for the vector, expressed in terms of elements.
- 注解
- This capacity is not necessarily equal to the vector size. It can be equal or greater, with the extra space allowing to accommodate for growth without the need to reallocate on each insertion.
- 返回
- The size of the currently allocated storage capacity in the vector, measured in terms of the number elements it can hold.
Removes all elements from the vector (which are destroyed), leaving the container with a size of 0.
- 注解
- All the elements in the vector will be released (referece count will be decreased).
bool contains | ( | T | object | ) | const |
| inline |
Returns a Boolean value that indicates whether object is present in vector.
Returns whether the vector is empty (i.e.
whether its size is 0).
- 注解
- This function does not modify the container in any way. To clear the content of a vector, see Vector::clear.
bool equals | ( | const Vector< T > & | other | ) | |
| inline |
Returns true if the two vectors are equal.
Removes from the vector with an iterator.
- 返回
- An iterator pointing to the new location of the element that followed the last element erased by the function call. This is the container end if the operation erased the last element in the sequence.
Removes from the vector with a range of elements ( [first, last) ).
- 返回
- An iterator pointing to the new location of the element that followed the last element erased by the function call. This is the container end if the operation erased the last element in the sequence.
Removes from the vector with an index.
- 返回
- An iterator pointing to the new location of the element that followed the last element erased by the function call. This is the container end if the operation erased the last element in the sequence.
void eraseObject | ( | T | object, | | | bool | removeAll = false | | ) | | |
| inline |
Remove a certain object in Vector.
Find the object in the vector.
- 返回
- Returns an iterator to the first element in the range [first,last) that compares equal to val. If no such element is found, the function returns last.
Returns the first element in the vector.
Returns index of a certain object, return UINT_MAX if doesn't contain the object.
T getRandomObject | ( | | ) | const |
| inline |
Returns a random element of the vector.
void insert | ( | ssize_t | index, | | | T | object | | ) | | |
| inline |
Insert a certain object at a certain index.
- 注解
- The vector is extended by inserting new elements before the element at the specified 'index', effectively increasing the container size by the number of elements inserted. This causes an automatic reallocation of the allocated storage space if -and only if- the new vector size surpasses the current vector capacity.
Returns the maximum number of elements that the vector can hold.
Copy assignment operator.
Move assignment operator.
Removes the last element in the vector, effectively reducing the container size by one, decrease the referece count of the deleted object.
void pushBack | ( | T | object | ) | |
| inline |
Adds a new element at the end of the vector, after its current last element.
- 注解
- This effectively increases the container size by one, which causes an automatic reallocation of the allocated storage space if -and only if- the new vector size surpasses the current vector capacity.
void pushBack | ( | const Vector< T > & | other | ) | |
| inline |
Push all elements of an existing vector to the end of current vector.
void replace | ( | ssize_t | index, | | | T | object | | ) | | |
| inline |
Replace object at index with another object.
Request a change in capacity.
reverses the vector
Shrinks the vector so the memory footprint corresponds with the number of items.
Returns the number of elements in the vector.
- 注解
- This is the number of actual objects held in the vector, which is not necessarily equal to its storage capacity.
- 返回
- The number of elements in the container.
void swap | ( | T | object1, | | | T | object2 | | ) | | |
| inline |
Swap two elements.
Swap two elements with certain indexes.
类成员变量说明
该类的文档由以下文件生成:
- /Users/zeroyang/Documents/github/cocos2d-x/cocos/base/CCVector.h
- cocos2d
- Vector
- 生成于 2014年 五月 29日 星期四 09:41:53 , 为 cocos2d-x使用 1.8.6