Note 11.1.1.
std::format
is new as of the C++20 standard. You will need to tell your compiler that you want to use C++20 features to make use of it.
There are other tools that can be used to format text. For example,
printf
is a function that has been around for a long time and is available in C and C++. You can also send special messages to cout
to tell it things like βdisplay numbers with 4 digits of accuracyβ. These other tools are still widely used, especially in code that has been around for a while. In this book, we will focus on std::format
because it has the best combination of safety and simplicity for modern C++ programming.