//******************************************************** // The following code example is taken from the book // C++23 - The Complete Guide // by Nicolai M. Josuttis (www.josuttis.com) // http://www.cppstd23.com // // The code is licensed under a // Creative Commons Attribution 4.0 International License // http://creativecommons.org/licenses/by/4.0/ //******************************************************** #include // for std::cout #include // for std::format #include // for std::print #include int main () { std::tuple t{47, 0.4, "hi", '?'}; // 4-element tuple std::cout << std::format("{}\n", t); std::cout << std::format("{:_^25}\n", t); std::println("{:_^25}\n", t); std::println("default: {}", t); std::println("{{:n}} : {:n}\n", t); std::pair p{"val", 11}; // could also be a 2-elem tuple std::println("default: {}", p); std::println("{{:n}} : {:n}", p); std::println("{{:m}} : {:m}\n", p); }