Reputation: 133
I'm making a hooked modding code for GTA San Andreas. The game has its own classes, one of them is class CPed
. It handles the attributes of random pedestrians created by the game, which is huge in storage. I work with pointers to these objects in my code CPed*
. Right now I use vector<CPed*> myList;
to work with these objects/peds.
What is the most efficient way to store these into a container for further use? The game, itself, handles the destruction of these objects.
Upvotes: 1
Views: 88
Reputation: 39370
std::vector
should actually be enough for the most part. In general, when picking a container, you should think about operations you want to do with it, but vector
is almost always a good start.
If you need key-value lookup, then std::unordered_map
/std::map
could be of use as well.
If you need absolutely top performance, you need to benchmark different containers yourself. Using std::
algorithms and range-for should guarantee easy replacement.
Upvotes: 1