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

boost::pfr::names_as_array<T> does not work on structure include c array #162

Open
baker-Xie opened this issue Feb 23, 2024 · 4 comments
Open
Labels
duplicate help wanted PR with a fix wouod be appreciated

Comments

@baker-Xie
Copy link

demo code like this

#include "boost/pfr.hpp"

struct some_person {
    float data[3];
};

int main(int argc, const char* argv[]) {
    auto name = boost::pfr::names_as_array<some_person>();
}
@XRay3D
Copy link

XRay3D commented May 16, 2024

Incorrectly defines structures with nested arrays. If the arrays are length of 1, then everything works correctly.

struct {
    float arr1[3]{};
    float arr2[3]{};
} array1;
float array2[3][2]{};

qWarning() << pfr::tuple_size_v<decltype(array1)>; // 6
qWarning() << pfr::tuple_size_v<decltype(array2)>; // 6

@p00f
Copy link

p00f commented Sep 16, 2024

@baker-Xie @XRay3D did you find a solution or a non-boost way to do this? i want the name + value of struct fields

@XRay3D
Copy link

XRay3D commented Sep 28, 2024

@baker-Xie @XRay3D did you find a solution or a non-boost way to do this? i want the name + value of struct fields

Try use std::array.

@p00f
Copy link

p00f commented Sep 28, 2024

that is not an option - i don't control the structs i'm reflecting on 😅

@apolukhin apolukhin added duplicate help wanted PR with a fix wouod be appreciated labels Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate help wanted PR with a fix wouod be appreciated
Projects
None yet
Development

No branches or pull requests

4 participants