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).
精彩评论