Home | Libraries | People | FAQ | More |
pfr::for_each_field
// In header: <pfr/core.hpp> template<typename T, typename F> constexpr 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; pfr::for_each_field(my_struct{20, 22}, [&sum](const auto& field) { sum += field; }); assert(sum == 42);
Parameters: |
|