Formatting library (C++20)

From cppreference.com
< cpp‎ | utility
 
 
 
Formatting library
Formatting functions
(C++20)
(C++20)
(C++20)
(C++20)
Formatter
(C++20)
Formatting arguments
Format error
 

The text formatting library offers a safe and extensible alternative to the printf family of functions. It is intended to complement the existing C++ I/O streams library and reuse some of its infrastructure such as overloaded insertion operators for user-defined types.

Example:

std::string message = std::format("The answer is {}.", 42);


Formatting functions

(C++20)
stores formatted representation of the arguments in a new string
(function template)
(C++20)
writes out formatted representation of its arguments through an output iterator
(function template)
writes out formatted representation of its arguments through an output iterator, not exceeding specified size
(function template)
determines the number of characters necessary to store the formatted representation of its arguments
(function template)

Extensibility support and implementation detail

(C++20)
non-template variant of std::format using type-erased argument representation
(function)
non-template variant of std::format_to using type-erased argument representation
(function template)
class that provides access to a formatting argument for user-defined formatters
(class template)
(C++20)
class template that defines formatting rules for a given type
(class template)
formatting string parser state
(class template)
formatting state, including all formatting arguments and the output iterator
(class template)
argument visitation interface for user-defined formatters
(function template)
creates a type-erased object referencing all formatting arguments, convertible to format_args
(function template)
class that provides access to all formatting arguments
(class template)
exception type thrown on formatting errors
(class)