DEV Community

Cover image for C++ {fmt} Library Overview & Cheat Sheets
hacking C++
hacking C++

Posted on

C++ {fmt} Library Overview & Cheat Sheets

{fmt} is a fast(er) and safe(r) alternative to C stdio (printf,...) and C++ iostreams (std::cout,...) that uses a Pythonesque format string syntax and is the origin and inspiration of C++20's std::format and C++23's upcoming std::print.

This article on offers a comprehensive and accessible overview of {fmt} with lots of runnable examples and visual aids:

  • how to set it up
  • quick overview of its interface and capabilities
  • hierarchical, task-oriented "how-to print/format X" sections
  • how to print custom types
  • cheat sheets as quick reference for format specifications

Quick overview cheat sheet of the C++ printing and formatting library "{fmt}"
Quick overview cheat sheet of the time and date formatting tokens used by C++ 20's std::format, std::strftime and the {fmt} library

Top comments (2)

taugustyn profile image
Tomasz Augustyn

Thank you, good cheat sheets :)

pgradot profile image
Pierre Gradot

I like it! Great job :)