Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use better_enum from class #110

Open
gri6507 opened this issue Oct 11, 2022 · 1 comment
Open

Cannot use better_enum from class #110

gri6507 opened this issue Oct 11, 2022 · 1 comment

Comments

@gri6507
Copy link

gri6507 commented Oct 11, 2022

I would like to declare a better_enum from inside a class. For example,

#include <enum.h>
class A
{
  public:
    BETTER_ENUM(Word, int, Hello, World)
    A(Word x){}
};

int main()
{
  A x(Word::Hello);
  return 0;
}

Unfortunately, this fails to compile. However, if I move the BETTER_ENUM declaration outside of the class, this works just fine. Is there another way to declare a better_enum inside a C++ class?

@BrainStone
Copy link

It literally says that it is a limitation in the README and even offers a workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants