如何连接两个cocos2d :: Vector s?
cocos2d::Vector<FiniteTimeAction*> V1;
cocos2d::Vector<FiniteTimeAction*> V2;
我想将V2附加到V1;
答案 0 :(得分:2)
cocos2d :: Vector重载了pushBack,它接受一个向量并将其推回到另一个向量。
V1.pushBack(V2);
CCVector.h
/** Adds a new element at the end of the Vector. */
void pushBack(T object)
{
CCASSERT(object != nullptr, "The object should not be nullptr");
_data.push_back( object );
object->retain();
}
/** Push all elements of an existing Vector to the end of current Vector. */
void pushBack(const Vector<T>& other)
{
for(const auto &obj : other) {
_data.push_back(obj);
obj->retain();
}
}
P.S不清楚为什么他们不在重载的pushBack中使用pushBack(T对象)(const Vector&amp; other)