_children 是
Vector<Node*> _children;
template<class T>
class CC_DLL Vector
是cocos2d-x封装的
_children.pushBack(child);
// Adds objects
/** @brief Adds a new element at the end of the vector, after its current last element.
* @note 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(T object)
{
CCASSERT(object != nullptr, "The object should not be nullptr");
_data.push_back( object );
object->retain();
}
大家可以调试追踪