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

Is it possible to handle C arrays? Possible implementation linked #185

Open
quicknir opened this issue Sep 23, 2024 · 8 comments
Open

Is it possible to handle C arrays? Possible implementation linked #185

quicknir opened this issue Sep 23, 2024 · 8 comments
Labels
help wanted PR with a fix wouod be appreciated

Comments

@quicknir
Copy link

quicknir commented Sep 23, 2024

There's another library called repr which claims to handle C arrays properly: https://godbolt.org/z/vbz639n4d. Can this solution be used to handle C arrays properly in boost pfr?

Here's a link to the implementation as it appears in the source tree (rather than amalgamated): https://github.com/Tsche/repr/blob/master/include/librepr/reflection/detail/arity.h

@Tsche
Copy link

Tsche commented Sep 23, 2024

This defect was one of the reasons I wrote my own library :P

Related:
#16
#20
#162
#169
#170

@p00f
Copy link

p00f commented Sep 27, 2024

The fix in #170 works, I've tested it with giant multiply-nested structs

@apolukhin
Copy link
Member

Solution from #170 breaks multiple tests. It requires some additional tweaking, I'd appreciate a PR.

As a quick workaround you could replace native C array with std::array

@apolukhin apolukhin added the help wanted PR with a fix wouod be appreciated label Oct 17, 2024
@p00f
Copy link

p00f commented Oct 17, 2024

std::array is not an option because the structs containing the arrays are from headers i don't control

I'm willing to fix the tests but don't have much experience with template metaprogramming, would it be fine if I give it a try and you can guide me in the PR?

@p00f
Copy link

p00f commented Oct 17, 2024

Also, how do I run the tests?

@apolukhin
Copy link
Member

would it be fine if I give it a try and you can guide me in the PR?

Yes, I'll do my best

Also, how do I run the tests?

I usually checkout the whole Boost with submodules https://github.com/boostorg/boost

Then run the ./bootstrap.sh

After that

cd libs/pfr/test
../../../b2 cxxstd=17 toolset=clang-19

@p00f
Copy link

p00f commented Oct 19, 2024

cxxstd=17

don't you need 20 for this names_as_array and friends?

toolset=clang-19

my distro only has llvm 18

regardless, i'll try and see if this works

@p00f
Copy link

p00f commented Oct 19, 2024

#189

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted PR with a fix wouod be appreciated
Projects
None yet
Development

No branches or pull requests

4 participants