Vector<node*> vec;
auto node1 = Node::create();
node1->setTag(
1
);
vec.pushBack(node1);
auto node2 = Node::create();
node2->setTag(
2
);
vec.pushBack(node2);
auto node3 = Node::create();
node3->setTag(
3
);
vec.insert(
,node3);
//输出指定位置的元素
Node* vecNode = static_cast<node*>(vec.at(
));
log(
"vecNode->getTag() = %d"
Map<std::string,node*=
""
> map1 ;
map1.insert(
"name"
Node* tempNode = static_cast<node*>(map1.at(
));
"tempNode->getTag() = %d"
原文链接:https://www.f2er.com/cocos2dx/346329.html