Hello guys,
I have a std::map with a char* as key and an enum as value. If I print the values uf the enum I get the correct list from 0 to ...
But if I want to get the enum value by using the map with the key all the output values are 0.
#define COUT(cmd) (dbPrint((LONGLONG)CommandList[#cmd]))
#define CMD(cmd) (CommandList[#cmd] = (cmd))
static enum ECommandList{
brk, // break
hel, // help
hal, // help all
sdm, // set display mode
sfr, // set fore color red
sfg, // set fore color green
sfb, // set fore color blue
sfw, // set fore color white
sfk, // set fore color black
sbr, // set fore back red
sbg, // set fore back green
sbb, // set fore back blue
sbw, // set fore back white
sbk // set fore back black
};
static std::map<const char*, ECommandList> CommandList;
CMD(brk);
CMD(hel);
CMD(hal);
CMD(sdm);
CMD(sfr);
CMD(sfg);
CMD(sfb);
CMD(sfw);
CMD(sfk);
CMD(sbr);
CMD(sbg);
CMD(sbb);
CMD(sbw);
CMD(sbk);
COUT(brk); // prints 0
COUT(hal); // prints 0
//... all other print 0 as well
Does anyone have an idea what I am doing wrong (the above listing is just the relevant part of the code)?
Thanks and best wishes.
Casting, the art of manipulation; further information every day in TV.