-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Modern C++ Programming Cookbook - Second Edition
By :
The C++ language has two ways of formatting text: the printf family of functions and the I/O streams library. The printf functions are inherited from C and provide a separation of the formatting text and the arguments. The streams library provides safety and extensibility and is usually recommended over printf functions, but is, in general, slower. The C++20 standard proposes a new formatting library alternative for output formatting, which is similar in form to printf but safe and extensible and is intended to complement the existing streams library. In this recipe, we will learn how to use the new functionalities instead of the printf functions or the streams library.
The new formatting library is available in the header <format>. You must include this header for the following samples to work.
The std::format() function formats its arguments according to the provided formatting string...