开发者

Very Basic std::vector iterating

std::vector<Ogre::SceneNode*>::iterator itr;
for(itr=mSelectedObjects.beg开发者_如何学Cin();itr!=mSelectedObjects.end();itr++){
    itr->showBoundingBox(true); //here
}

I'm getting "expression must have pointer-to-class type" on the marked line, and I'm not sure why. Can anyone help?


Replace the erroneous line with:

(*itr)->showBoundingBox(true); //here

Since you're storing pointers, you need to dereference itr twice to get from the iterator to the object (once for the iterator and once for the pointer).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜