• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reverse lookup and removal of object in a vector.  RSS feed

 
Gerald Luckenbill
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
This might be an easy problem for someone but I can't see to get it down:
What I have is a vector which contains objects that are a bean class I created.
What I need to do is go thru this vector in reverse order - and remove from the bottom up the beans from the vector until I hit a bean which contains an int that is equal to another int that my program knows about. Then I have to remove that bean - but then I want to stop - I don't want to remove any beans above that in the vector. Of course, my bean has some method like getMyInt() that I will use.
Does anyone follow this? I don't think it is hard - I am just stuck on it.
Many Thanks!
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the following code might help you... I'm not sure whether it is the goal that u want... :roll:
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!