Ok, I was wondering if somebody could give me some clarification on a topic that just doesn't seem to make sense to me. I have a class that tells my program all the attributes needed to build another player in my game but there could be 3 players logged in sometimes or 20 players logged in so it needs to be able to dynamically change all the time. I was told that using a vector could solve this problem because you can constantly change its value. But I am having problems understanding it. Would it be like for every player in the game there is another element added to the vector and it uses the sizeof function thing and thats how many objects it needs to instantiate from my class. I just need some further clarification on it. Any help is appreciated. Thanks.

10 Years
Discussion Span
Last Post by CoolGamer48

You can easily google STL vector information/documentation/library and learn from there.

Here are some basic features.
Vectors are similar to arrays but they are not fixed sizes, they can grow.
When the vector is close to its capacity it will allocate more space automatically.

There are functions to get element by index, get current amount of items in vector and more.

Vectors are templatized meaning it can only store 1 type of objects you can have vectors of ints, or chars, or in your case players but cant be ints and chars.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.