28 Dec, 2009, BrainFRZ wrote in the 1st comment:
Votes: 0
I'm working on a table with a list of ranges for each row header. At first I did const std::string salaryRanges[] out of habit. After taking a second look, however, I realized that there was no point in having any extra functionality, so I decided to go with const char *const salaryRanges[]. Pretending it was an issue, what's the difference in memory usage between const std::string[] and const char *const[]?
29 Dec, 2009, quixadhal wrote in the 2nd comment:
Votes: 0
Memory use would be pretty small unless we're talking a huge table.
I'd still use std::string, just to avoid all the issues char *'s bring with them.
29 Dec, 2009, David Haley wrote in the 3rd comment:
Votes: 0
Every string carries just a little bit more information per string than a const char*. How much information this is is obviously implementation dependent, but it's probably to the tune of very-low-double-digit bytes. A char* will always be 4 or 8 bytes (assuming 32 and 64 bit architecture respectively). You can always do sizeof(std::string) to see how much memory the structure itself consumes (as opposed to the underlying char*).
29 Dec, 2009, Runter wrote in the 4th comment:
Votes: 0
Unless you really need to worry about the memory use on this scale I wouldn't put much thought into it.

The reason string classes use more memory is because they do more. In a (relatively) large scale string based application it doesn't even really matter, and I'm not sure I'd start trying to cherry pick the exact places I need to use a string library and the places I want to use ad hoc C strings. You can't really predict your future needs. Go with std::string.