//******************************************************** // 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 "structbind1.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: std::string s{std::move(f)}; l = "Waters"; v += 10; std::cout << "f/l/v: " << f << ' ' << l << ' ' << v << '\n'; std::cout << "c: " << c.getFirst() << ' ' << c.getLast() << ' ' << c.getValue() << '\n'; std::cout << "s: " << s << '\n'; }