Home Comments

Allow using C++11 enum classes

grembogrembo Member Michael GmelinOrganization: Grem Equity GmbHProject: E-Commerce platform
Hi,

it would be great if strongly typed enums (enum classes) could be included in the C++ language mapping (probably triggered by an attribute). Beyond the benefit of type safety this would also allow using them like they're used in other language mappings.




E.g.
enum Normal
{
  one,
  two,
  three
};

["cpp:class"]
enum Strong
{
   alpha,
   beta,
   gamma
};

Would map to C++:
enum Weak
{
   one,
   two,
   three
};

enum class Strong
{
   alpha,
   beta,
   gamma
};

And be used like this:
Weak w = one;
Strong s = String::alpha;

Cheers,
Michael
Sign In or Register to comment.