我可以创建一个包含多个类型声明的for循环吗?(Can I create a for loop containing multiple type declarations?)
例如:
有什么我可以做的,这可能会让我做到这一点:
for(TiXmlElement * pChild = elem->First(), int i=0; // note multiple type declarations pChild; pChild=pChild->NextSiblingElement(), i++) // note multiple types { //do stuff }也许有一个boost标题?
For example:
Is there anything I can do, that might allow me to do this:
for(TiXmlElement * pChild = elem->First(), int i=0; // note multiple type declarations pChild; pChild=pChild->NextSiblingElement(), i++) // note multiple types { //do stuff }Perhaps there is a boost header?
最满意答案
不。
如果你想限制变量的范围到循环中,只需添加另一个范围:
{ TiXmlElement * pChild = elem->First(); int i = 0; for(; pChild; pChild=pChild->NextSiblingElement(), i++) { //do stuff } }Nope.
If you want to limit the scope of variables to the loop just add another scope:
{ TiXmlElement * pChild = elem->First(); int i = 0; for(; pChild; pChild=pChild->NextSiblingElement(), i++) { //do stuff } }更多推荐
发布评论