pfr
pfr copied to clipboard
std::tuple like methods for user defined types without any macro or boilerplate code
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(); } ```
There is currently a limitation in the code for LOOPHOLE: > None of the member fields should have a template constructor with one parameter. This limitation could be solved using...
Since the opening curly braces '{' is read as a char, newlines and spaces set the state "failbit". This can be an issue for serializing containers in a struct, which...
Sometimes it might be useful to print the whole struct, including names of it's fields
https://godbolt.org/z/q6McGYzGW ``` error: no matching function for call to 'hash_detector_msvc_helper(long int)' 55 | template using hash_detector = decltype(hash_detector_msvc_helper(1L)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~ /opt/compiler-explorer/libs/boost_1_83_0/boost/pfr/detail/detectors.hpp:53:29: note: candidate: 'template decltype (std::hash{}(declval())) boost::pfr::detail::hash_detector_msvc_helper(long int)' 53 |...
Hi, I see in the Limitations section > Boost.PFR library works with types that satisfy the requirements of SimpleAggregate: aggregate types without base classes, const fields, references, or C arrays:...
The attached mini reproducer fails if compiled with Clang-16 on non-X86 platform: ``` #include #include #include struct user_type { char c; double d; }; int main() { using pfr_tuple =...
My use-case is to send a structure that has other structures as members via D-Bus. The D-Bus library accepts std::tuple so structure_to_tuple/structure_tie seems like a good fit to convert a...
https://godbolt.org/z/E8Pb1dzP3 It works in MSVC 19.16