struct snowball{
bool alive;
};
vector<snowball*> snowballs;
//fill snowballs with some objects through push_back()...
for(int i=0; i<snowballs.size(); i++){
if(snowballs[i]->alive){
//delete this element (how to code this?)
}
}
How do i delete that element?
I have looked into std::vector docs, but the only functions that comes close to doing the job are std::vector::erase() and std::vector::pop_back(). The problem is neither function allows me to specify&delete an element based on a member value.
This post has been edited by Java Student: 01 January 2013 - 01:11 AM

New Topic/Question
Reply




MultiQuote







|