Choose Array, String, or Vector

I

Immortal Nephi

How do I decide to choose either string, vector, or array? Either
string or vector have features, but vector has more features than
string because vector has the feature to grow or shrink memory size.
Also, they have search feature.
I don’t need to use neither search nor grow / shrink feature. I go
to use array instead. I write my own functions to manipulate array in
memory directly. I know what I am doing to be sure that my own
functions are free bugs (meaning data never walks out of the range
outside array elements in memory.) I have my own responsibility to
include array size in the functions when I test them to be working
properly.
My program is ideal for games. The fixed memory size has the
information to hold any bitmap images to be drawn to the screen. If I
create an array to hold character names, then I will choose vector to
use search feature. The search feature scans to pick up correct
character name in the array before bitmap image is chosen correctly to
be drawn on the screen.
Am I saying clear how I decide?
 
J

Jorgen Grahn

How do I decide to choose either string, vector, or array? Either
string or vector have features, but vector has more features than
string because vector has the feature to grow or shrink memory size.
Also, they have search feature.
I don?t need to use neither search nor grow / shrink feature. I go
to use array instead. I write my own functions to manipulate array in
memory directly. [...]
Am I saying clear how I decide?

Raw old C arrays are so troublesome and cause so many bugs (just look
at the postings here) that you should have had arguments *for* using
it. You only listed std::vector/string features which you didn't need.

/Jorgen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,967
Messages
2,570,148
Members
46,694
Latest member
LetaCadwal

Latest Threads

Top