~/talk

C++20 String Formatting Library: An Overview and Use with Custom Types

TalkinDutchat CppCon 2020 · 2020-09-14..09-18· [compilers-and-language-design]
links:none on file
slides:none on file

C++20 introduces std::format and the std::formatter customization point for formatting text. The talk covers how to specialize std::formatter to print custom types and parse custom key/value format options, shows error reporting for bad specifiers, demonstrates locale-aware number formatting and a center-alignment option not available in iostreams, and notes the implementation is based on the fmt library. Microbenchmarks are presented showing std::format is much faster than iostreams (hundreds of thousands of formats/sec) and performs similarly to fmt, while customization is straightforward.

AI-written summary · about

  1. 0:00Introduction to C++20 string formatting
  2. 1:12Why a new formatting library
  3. 3:42Advantages of C++20 formatting
  4. 4:49Placeholders and format specifiers
  5. 7:19Field width and alignment
  6. 9:49Number formatting options
  7. 11:59Custom format specifiers
  8. 15:29Floating-point formatting
  9. 18:01Hexadecimal and binary output
  10. 20:04Performance comparison
  11. 21:49Support for custom types
  12. 24:17Key-value pair formatting
  13. 26:23Localization and advantages
  14. 27:30Comparison with existing libraries
  15. 28:15Summary and Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.