fmtlib/fmt: A modern formatting library (github.com)
{fmt} is an open-source formatting library providing a fast and safe alternative to C stdio and C++ iostreams.
Q&A: ask questions on StackOverflow with the tag fmt.
Try {fmt} in Compiler Explorer.
Features
- Simple format API with positional arguments for localization
- Implementation of C++20 std::format
- Format string syntax similar to Python's format
- Fast IEEE 754 floating-point formatter with correct rounding, shortness and round-trip guarantees using the Dragonbox algorithm
- Portable Unicode support
- Safe printf implementation including the POSIX extension for positional arguments
- Extensibility: support for user-defined types
- High performance: faster than common standard library implementations of
(s)printf
, iostreams,to_string
andto_chars
, see Speed tests and Converting a hundred million integers to strings per second - Small code size both in terms of source code with the minimum configuration consisting of just three files,
core.h
,format.h
andformat-inl.h
, and compiled code; see Compile time and code bloat - Reliability: the library has an extensive set of tests and is continuously fuzzed
- Safety: the library is fully type-safe, errors in format strings can be reported at compile time, automatic memory management prevents buffer overflow errors
- Ease of use: small self-contained code base, no external dependencies, permissive MIT license
- Portability with consistent output across platforms and support for older compilers
- Clean warning-free codebase even on high warning levels such as
-Wall -Wextra -pedantic
- Locale independence by default
- Optional header-only configuration enabled with the
FMT_HEADER_ONLY
macro
See the documentation for more details.
标签:code,format,fmt,library,高性能,C++,support From: https://www.cnblogs.com/sinferwu/p/17579746.html