//******************************************************** // The following code example is taken from the book // C++17 - The Complete Guide // by Nicolai M. Josuttis (www.josuttis.com) // http://www.cppstd17.com // // The code is licensed under a // Creative Commons Attribution 4.0 International License // http://creativecommons.org/licenses/by/4.0/ //******************************************************** #include "structbind2.hpp" #include int main() { Customer c{"Tim", "Starr", 42}; auto [f, l, v] = c; std::cout << "f/l/v: " << f << ' ' << l << ' ' << v << '\n'; // modify structured bindings via references: auto&& [f2, l2, v2] = c; std::string s{std::move(f2)}; f2 = "Ringo"; v2 += 10; std::cout << "f2/l2/v2: " << f2 << ' ' << l2 << ' ' << v2 << '\n'; std::cout << "c: " << c.firstname() << ' ' << c.lastname() << ' ' << c.value() << '\n'; std::cout << "s: " << s << '\n'; }