In C++11 we could define e.g.:
Code: Select all
enum class HorizAlignment { LEFT, CENTRE, RIGHT };
enum class VertAlignment { TOP, CENTRE, RIGHT };
This won't compile in C++03, and this won't either:
Code: Select all
enum HorizAlignment { LEFT, CENTRE, RIGHT };
enum VertAlignment { TOP, CENTRE, RIGHT };
Because "CENTRE" is defined twice! We could, of course, do:
Code: Select all
enum HorizAlignment { HORIZ_ALIGNMENT_LEFT, HORIZ_ALIGNMENT_CENTRE, HORIZ_ALIGNMENT_RIGHT };
enum VertAlignment { VERT_ALIGNMENT_TOP, VERT_ALIGNMENT_CENTRE, VERT_ALIGNMENT_RIGHT };
But that's not very pretty. Now, in my own code (outside CEGUI) I use the following hack:
Code: Select all
struct HorizAlignment { enum { LEFT, CENTRE, RIGHT }; };
struct VertAlignment { enum { TOP, CENTRE, RIGHT }; };
And then I can refer it like in C++11, as e.g. "HorizAlignment::CENTRE" or "VertAlignment::CENTRE".
And my question is: If I add a new enum to the "v0-8" or "v0" branches (which use C++03), do u have any objection if I use this hack in CEGUI code? Then when merging to "default" branch I'll just change it to "enum class" without "struct".