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

Declare inside class #20

Closed
fnc12 opened this issue Jun 2, 2016 · 2 comments
Closed

Declare inside class #20

fnc12 opened this issue Jun 2, 2016 · 2 comments

Comments

@fnc12
Copy link

fnc12 commented Jun 2, 2016

I want to make a role field for a user. So I try to compile this code:

struct User{
    BETTER_ENUM(Role, int,
                user,
                driver)
};

and it tells me Missing '}' at end of definition of 'User' at the first line and Extraneous closing brace ('}') at the last line. Compiling using Xcode 7.3.1. The issue is how to create enum enclosed inside a class?

@aantron
Copy link
Owner

aantron commented Jun 3, 2016

Hi, this isn't possible in current versions, unfortunately. I believe this should work as a workaround, however:

BETTER_ENUM(some_ugly_prefix_Role, int, user, driver)

struct User {
    using Role = some_ugly_prefix_Role;
    // ...
};

@fnc12
Copy link
Author

fnc12 commented Jun 5, 2016

@aantron thanks

@fnc12 fnc12 closed this as completed Jun 5, 2016
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