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

Add @optional( <name> ) annotation for optional fields #173

Closed
VeaaC opened this issue Apr 19, 2020 · 1 comment
Closed

Add @optional( <name> ) annotation for optional fields #173

VeaaC opened this issue Apr 19, 2020 · 1 comment

Comments

@VeaaC
Copy link
Collaborator

VeaaC commented Apr 19, 2020

a common pattern used in flatdata is too use a fixed value to indicate a missing field, e.g.

const u32 INVALID_INDEX = 0xFFFFFFFF;
struct MyStruct {
    @const( INVALID_INDEX )
     index : u32;
}

I propose making this a use case that we should support properly:

  • add @optional( <const_name> ) annotation
  • generate Option<T>/boost::optional/whatever getters/setters
  • Allow fast access to raw data via special getter (e.g. field_name_raw()?)
@VeaaC
Copy link
Collaborator Author

VeaaC commented May 3, 2020

Duplicates #80

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

1 participant