Originally posted by clockworks
std::string will not work for what i want. i'm writing a huffman encoder and i have a map of frequencies per "chunk". a chunk could be 1, 2, 3, or n bytes.
std::string can be 1, 2, 3, or n bytes. So far your reasoning doesn't eliminate std::string
so lets say i want to count the frequencies of 2 byte chunks of a text file. thus i want a map<char*, int> to do something like the following psudocode:
char chunk[2];
while (!eof) {
read_chunk(chunk, file);
freq_map[chunk] += 1;
}
This particular "chunk" is a sequence of some characters, correct? Does this same sequence keep changing but the pointer to it stay the same? Unless this is the reason for using pointers, there is nothing in the pseudo-code you posted that makes std::string unusable. As a matter of fact, the very first line (char chunk[2]) is a dead giveaway that std::string can be used.

Regards,

Paul McKenzie