Boost C++ Libraries 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.

Function template tie_from_structure

boost::pfr::tie_from_structure — std::tie-like function that allows assigning to tied values from aggregates.


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

template<typename... Elements> 
  unspecified tie_from_structure(Elements &... args);



auto f() {
  struct { struct { int x, y } p; short s; } res { { 4, 5 }, 6 };
  return res;
auto [p, s] = f();
tie_from_structure(p, s) = f();


an object with lvalue references to args...; on assignment of an simple aggregate value to that object each field of an aggregate is assigned to the corresponding args... reference.