pfr icon indicating copy to clipboard operation
pfr copied to clipboard

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

Open baker-Xie opened this issue 1 year ago • 4 comments

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>();
}

baker-Xie avatar Feb 23 '24 10:02 baker-Xie

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

XRay3D avatar May 16 '24 08:05 XRay3D