Boost
C++ Libraries
...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
This is an older version of Boost and was released in 2023. The current version is 1.89.0.
boost::pfr::for_each_field
// In header: <boost/pfr/core.hpp> template<typename T, typename F> void for_each_field(T && value, F && func);
Calls func for each field of a value.
Example:
struct my_struct { int i, short s; }; int sum = 0; boost::pfr::for_each_field(my_struct{20, 22}, [&sum](const auto& field) { sum += field; }); assert(sum == 42);
Parameters: |
|