Hi Everyone,
I've been browsing around for solutions to how to have an enum that gives me a name string. Some rather complicated ones can be found on the gamedev forum and Code Project.
I am thinking about simply writing a script that takes a list of names and generates a class like so.
and then just using the class like an enum. The downside is that I would have to rerun my script every time the list changed. The upside is that its extremely simple.
Does anyone know why I should favor more complicated methods using macros or STL maps? God didn't give me enough patience for Macros.
I've been browsing around for solutions to how to have an enum that gives me a name string. Some rather complicated ones can be found on the gamedev forum and Code Project.
I am thinking about simply writing a script that takes a list of names and generates a class like so.
Code:
class GangstaEnum { public: int VanillaIce = 0; int MrT = 1; int MrRogers = 2; char* get_str(int idx){return gangstas[idx];} private: char[3] gangstas = {"VanillaIce", "MrT"};
Does anyone know why I should favor more complicated methods using macros or STL maps? God didn't give me enough patience for Macros.
Comment