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 the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Function template io

boost::pfr::io

Synopsis

// In header: <boost/pfr/io.hpp>


template<typename T> auto io(T && value);

Description

IO manupulator to read/write simple aggregate value using its IO stream operators or using boost::pfr::io_fields if operators are not awailable.

Example:

struct my_struct { int i; short s; };
my_struct s;
std::stringstream ss;
ss << "{ 12, 13 }";
ss >> boost::pfr::io(s);
assert(s.i == 12);
assert(s.i == 13);

See Also : 'Custom printing of aggregates' for info on how to implement your own manipulator with custom format.


PrevUpHomeNext