I had this nice array-object named army[] from a struct named soldier, which included some names with their respective random attributes. I decided that if one of my soldiers would get killed it would be easier to use a vector with the "erase" command to remove the deadman from my list.
Initially it looked something like this when I placed soldiers into my army[]:
Now, how do I this sort of thing in "vector form".
I've been messing around with vector::push_back iterators with no success;
made it in without errors using a vector::at, but then it crashed at run-time.
I don't know if I am making myself clear enough, but perhaps someone understands what I mean.
Thanks
Well... My vector::erase idea might not be the best after all. If I kill a wolf in a certain part of my map it is erased from its spot in the vector and the bear formerly one spot "higher" in the vector and in the other corner of the map suddenly takes his place in the vector and on the map. So who knows how my army vector is doing.
What is the best method of removing items from a list?
I found it... I need to spend more time reading the introductions, not just look at the example. So I guess there are also these things out there called deques and lists, where lists are the most useful in removing an item from a stack without others falling down into its empty space.
Thanks anyway.