I am aware that the c++20 format proposal is a formalization of parts of libfmt, and that libfmt is a compliant implementation of that formalization. However, it's my understanding that libfmt provides additional functionality beyond that specified in the c++20 standard. What are the additional features?
Additional, are the major compiler vendors simply including a subset of libfmt or reimplementing it?
{fmt} is an open-source formatting library providing a fast and safe alternative to C stdio and C++ iostreams.
To use the {fmt} library, add fmt/core. h , fmt/format. h , fmt/format-inl. h , src/format.cc and optionally other headers from a release archive or the Git repository to your project.
fmtstr or sequence of strs, optional. A single format (%10.5f), a sequence of formats, or a multi-format string, e.g. 'Iteration %d – %10.5f', in which case delimiter is ignored. For complex X, the legal options for fmt are: a single specifier, fmt='%.
There are a bunch of things in libfmt that are not in C++20 format:
fmt::print()
to print directly to stdout. This is proposed in P2093. fmt::printf()
also exists but is not proposed in that paper.fmt::memory_buffer
as basically a dynamically sized container that you could format into via fmt::format_to(buf, ...)
.fmt::join()
.fmt::print("Elapsed time: {s:.2f} seconds", "s"_a=1.23);
FMT_COMPILE
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With