Quote:Original post by mikeman
Quote:Original post by Palidine
Quote:Original post by mikeman
I believe a linked list is more appropriate. That's what I use for bullets and other things, like particles. I think it's more flexible than a resizable array.
how is a linked list more flexible? std::vector acts almost exactly like a linked list but with the access times of an array. it's not the right solution for everything b/c there are occasional memory hits when the array needs to resize but it's perfect for this. especially since the max number of bullets alive at any given time is a finite and relatively predictable number.
-me
I just like the fact that you can add and remove any object at any time, without having to check for unused objects, or resizing the array appropriately. I find it easier to implement it that way.
With vectors you can add and remove any object at any time as far as I'm aware and the size is handled automatically. I agree that linked lists are probably more flexible as you are setting them up yourself and have control of exactly what they do, but for this situation I think its more complicated than it needs to be. Just my two pents, I mean cents. ;)