Recommended Posts

I want to have a hash map, whose key is a character, and whose value is an array of characters (which I will actually use for small integers).
By the way, I will hard-code the values for each array associated with each character, and all arrays will not be the same size.
I cant come up with the syntax to get it to work.
I tried declaring the hash like this:
hash_map<char, char*> theHash;
and just storing pointers to the array of characters.
but then I have to do something like this:
char *temp;
temp = newchar[I need to know the size here!];
temp={4, 2, 6, 9, 23, 1, 5}; // syntax like this doesnt work!
I also tried declaring the hash like this:
hash_map<char, char[]> theHash;
,and actually storig the array in the hash, but I couldnt get that to work either.

Ideally, this is what I would like to be able to do: (but of course this syntax doesnt work)
theHash['A'] = {3,4,2,6,22,9,21};
theHash['B'] = {1,4,6};
theHash['C'] = {7,5,3,2,1,5,6,7,4,2,1,54,3};
..
theHash['Z'] = {3,4,6,7,5,};
But I cant get anything I try to work.
Also, I would like the final solution to be compact like that; I dont want to have to mess with 20 or so lines of code for each letter of the alphabet.
I'll bake a caek for whoever can figure this mess out!
[edited by - AndreTheGiant on March 25, 2004 11:38:33 PM]