J
Jan Krumsiek
Hi all.
I have a virtual "world" with different objects which are "born" and
which "die" sometimes. This means I have a variable amount of objects in
this world which I need to store in some structure.
Sounds like a perfectly good job for vectors (STL).
Another method would be to create a pre-defined, empty array. Now if an
object is born, the next free slot in this array is searched and the new
object is stored at that position. When an object dies, the
corresponding slot is simply "freed" again.
Now my question:
Which of this methods (STL, array) will be faster if my world has a huge
number of objects (5000-10000)?
Maybe any other ideas?
Regards,
Jan
I have a virtual "world" with different objects which are "born" and
which "die" sometimes. This means I have a variable amount of objects in
this world which I need to store in some structure.
Sounds like a perfectly good job for vectors (STL).
Another method would be to create a pre-defined, empty array. Now if an
object is born, the next free slot in this array is searched and the new
object is stored at that position. When an object dies, the
corresponding slot is simply "freed" again.
Now my question:
Which of this methods (STL, array) will be faster if my world has a huge
number of objects (5000-10000)?
Maybe any other ideas?
Regards,
Jan