A C++14 library providing std::tuple-like reflection for user-defined types without macros or boilerplate.
Boost.PFR is a C++14 library that provides basic reflection capabilities for user-defined aggregate types, enabling tuple-like operations such as index-based field access and serialization without requiring macros or boilerplate code. It solves the problem of introspecting structure members at compile time, which is useful for generic programming, logging, and I/O operations.
C++ developers working on projects that require serialization, logging, or generic programming with user-defined types, particularly those using C++14 or later who want reflection without macro overhead.
Developers choose Boost.PFR because it offers a simple, header-only solution for reflection that integrates seamlessly with existing code, requires no dependencies, and avoids the complexity and maintenance issues associated with macro-based approaches.
std::tuple like methods for user defined types without any macro or boilerplate code
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
As a header-only library with no dependencies, it can be copied directly into any C++14+ project without build system changes, as highlighted in the README.
Eliminates boilerplate macros by enabling index-based field access and tuple operations on user-defined aggregates, shown in motivating examples like boost::pfr::get<N>().
Provides automatic serialization to streams via boost::pfr::io(), allowing logging and debugging without manually defining output operators, as demonstrated in the examples.
Operates with zero runtime overhead by leveraging compile-time introspection, aligning with the library's philosophy of performance-conscious design.
Only works with aggregate-initializable structures, excluding classes with private members, constructors, or inheritance, which restricts use in object-oriented designs.
Requires C++14 or later, making it incompatible with older codebases, and may have compiler-specific quirks as noted in the documentation's requirements section.
Heavy use of template metaprogramming can significantly increase compile times, especially in large projects with many reflected types or complex hierarchies.