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

MAX_NUMBER_OF_MEMBERS #376

Closed
mjhurd opened this issue Dec 29, 2017 · 4 comments
Closed

MAX_NUMBER_OF_MEMBERS #376

mjhurd opened this issue Dec 29, 2017 · 4 comments

Comments

@mjhurd
Copy link

mjhurd commented Dec 29, 2017

Hi,

Boost Hana's wonderfulness is unavailable for some autogen structs from table work I'm working with.

I have more than 62 columns - to be members - of the table - to be struct.

Unfortunately, the ERB in hana/detail doesn't like the idea of more than 62 members in a struct.

MAX_NUMBER_OF_MEMBERS = (ENV["MAX_NUMBER_OF_MEMBERS"] || 40).to_i raise "MAX_NUMBER_OF_MEMBERS must be <= 62" if MAX_NUMBER_OF_MEMBERS > 62

Pretty sensible for handcrafting but a bit limiting for my autogen work. Any thoughts on how best to raise the bar to 79 or 99 members?

Kind regards,

--Matt.

@ricejasonf
Copy link
Collaborator

It looks like the ERB is just generating preprocessor macros which have a limit to the amount of arguments that a macro can receive.

The docs for Struct show that you can implement hana::accessors for your type directly instead of using the macro. It's not very pretty, but if you are generating code heterogeneously (outside of c++) that probably doesn't matter.

See the examples below "Minimal Complete Definition" here: Struct

@mjhurd
Copy link
Author

mjhurd commented Dec 30, 2017

Thanks for the link to Struct. That'll do the job I need.

@mjhurd mjhurd closed this as completed Dec 30, 2017
@ldionne
Copy link
Member

ldionne commented Jan 1, 2018

I was away over the holidays. Reopening since I think we need a better solution. The ERB could generate the macros it needs for up to the right number of elements. In other words, we could lift the restriction that MAX_NUMBER_OF_MEMBERS <= 62.

@ldionne ldionne reopened this Jan 1, 2018
ldionne added a commit that referenced this issue Feb 10, 2018
This is done by generating the supporting preprocessor macros with ERB up to
the required arity, like we do for the struct macros themselves.

Fixes #376
@ldionne
Copy link
Member

ldionne commented Feb 10, 2018

This should now be addressed. You can now generate struct_macros.hpp without any restriction on the number of members. This will be in Boost 1.67.

@ldionne ldionne closed this as completed Feb 10, 2018
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

3 participants