Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Normal
PFR 101[CODE]// Increment each field of the variable on 1 and// output the content of the variable.#include <cassert>#include <boost/pfr.hpp>#include <boost/type_index.hpp>#include <iostream>struct test { int f1; long f2;};test var{ 42, 43 };boost::pfr::for_each_field(var, [](auto& field) { field += 1; });// Outputs: {43, 44}std::cout << boost::pfr::io(var);[/CODE]
PFR 101
[CODE]// Increment each field of the variable on 1 and
// output the content of the variable.
#include <cassert>
#include <boost/pfr.hpp>
#include <boost/type_index.hpp>
#include <iostream>
struct test {
int f1;
long f2;
};
test var{ 42, 43 };
boost::pfr::for_each_field(var, [](auto& field) {
field += 1;
});
// Outputs: {43, 44}
std::cout << boost::pfr::io(var);[/CODE]