A string constant is a constchar*
BTW std::map won't work well with C style string, why don't you make it typedef std::map<std::string, SDL_Surface*> Images;?
oh right... I always miss the obvious stuff. :/
Thanks.
I didn't use a std::string because it is constant.
Because I will never be adding to it I figured I might as well save the tiny bit of memory and not use a bulkier storage class. Not that the extra space is really a lot or anything.
std::map uses comparison operators to sort the elements and they won't work as expected with C strings ( since you are comparing pointers and not strings )
A std::string doesn't consume really large amounts of memory
odd thing thought, it has worked fine actually.
Maybe gpp scans and assigns all hard coded C strings the same address. (good thing actually)
Well with that knowledge and hypothesis , to prevent a non hard coded C string from screwing everything up, I'll convert to a std::string.
That is.. if I remember to after this conversation I'm about to have.
It is likely that if you have more than one .cpp file that accesses the map by hard-coded string,
then one of the .cpp files will mysteriously not be able to find the key. This is because the
linker is more than likely not smart enough to fold all the same constants into one across multiple
translation units.