std::format & std::print (C++23)
std::print/println, formatting ranges and containers, escaping, width estimation, fill characters, chrono locale fixes, thread::id/stacktrace formatters.
Connected features
Papers
13 · Virtual Jun 2021 → Issaquah 2023Makes std::format check its format string at compile time (format_string) and adds vformat for runtime strings (DR C++20).
Makes chrono formatting locale-independent by default, with the L flag opting in (DR C++20).
Lets std::format take arguments by forwarding reference so non-copyable, generator-like types can be formatted (DR C++20).
Adds std::print and std::println: formatted output to stdout, FILE* or streams, with Unicode handling.
Adds formatting for ranges and tuples, with range format specs and format_kind.
Clarifies encoding handling in localized formatting of chrono types.
Exposes std::basic_format_string so user code can wrap std::format with compile-time checked strings.
Improves default container formatting: maps as {k: v}, sets as {...}.
Requires std::print to a terminal to synchronize with the underlying stream.
Allows any Unicode scalar value except { and } as a fill character in std::format.
Fixes std::format's width estimation using East Asian Width and grapheme clusters.
Adds formatters for std::thread::id and std::stacktrace.
Improves the ? escaping rules for strings and characters in std::format.