Up to [cvs.NetBSD.org] / pkgsrc / textproc / fmtlib
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
fmtlib: update to 12.2.0.
# 12.2.0 - 2026-06-16
- Added a C11 API that brings fast, type-safe formatting to C. The new
`fmt-c` library and `fmt/fmt-c.h` header use `_Generic` to dispatch on
argument types and outperform `printf`/`sprintf`. For example:
```c++
#include <fmt/fmt-c.h>
fmt_print(stdout, "The answer is {}.\n", 42);
```
(https://github.com/fmtlib/fmt/issues/4663,
https://github.com/fmtlib/fmt/pull/4671,
https://github.com/fmtlib/fmt/pull/4696,
https://github.com/fmtlib/fmt/issues/4693,
https://github.com/fmtlib/fmt/pull/4694,
https://github.com/fmtlib/fmt/pull/4712,
https://github.com/fmtlib/fmt/pull/4789).
Thanks @Soumik15630m, @Ferdi265 and @localspook.
- Added a separate `fmt::fmt-module` CMake target for C++20 modules and a
CI workflow that exercises module-based builds
(https://github.com/fmtlib/fmt/issues/4684,
https://github.com/fmtlib/fmt/pull/4685,
https://github.com/fmtlib/fmt/issues/4707,
https://github.com/fmtlib/fmt/pull/4708,
https://github.com/fmtlib/fmt/pull/4702,
https://github.com/fmtlib/fmt/pull/4709).
Thanks @MathewBensonCode.
- Enabled the full Dragonbox lookup cache by default for floating-point
formatting unless optimizing for binary size (`__OPTIMIZE_SIZE__`),
giving a ~10–25% speedup. Thanks Matthias Kretz for the suggestion.
Average time per `double` on Apple M1 Pro (clang 17, random digits,
smaller is better) measured with
[dtoa-benchmark](https://github.com/fmtlib/dtoa-benchmark):
| Method | Time (ns) |
| ----------------------- | --------: |
| fmt (full) | 22.07 |
| fmt (compact) | 29.55 |
| ryu | 35.21 |
| double-conversion | 81.81 |
| `sprintf` | 726.27 |
| `ostringstream` | 864.34 |
- Improved integer formatting performance by ~3%
(https://github.com/fmtlib/fmt/pull/4630). Thanks @user202729.
- Optimized formatting into back-insert iterators by using bulk container
append/insert methods (e.g. on `std::vector<char>` and custom string
types) (https://github.com/fmtlib/fmt/pull/4679). Thanks @user202729.
- Reduced binary size of debug builds (~200k to ~85k in the bloat test) and
improved compile speed when `consteval` is unavailable.
- Made path formatting lossless, preserving ill-formed UTF-16
sequences when converting `std::filesystem::path` to a narrow string.
- Added support for formatting `std::unexpected`
(https://github.com/fmtlib/fmt/pull/4675). Thanks @17steen.
- Added overloads of `fmt::println` that take a `fmt::text_style`
(https://github.com/fmtlib/fmt/pull/4782). Thanks @ahoarau.
- Added support for positional arguments as width and precision specifiers
in `fmt::printf` (https://github.com/fmtlib/fmt/pull/4643).
Thanks @KareemOtoum.
- Made `FMT_STRING` a no-op when `FMT_USE_CONSTEVAL` is enabled, since the
consteval format-string constructor already provides compile-time
validation
(https://github.com/fmtlib/fmt/issues/4611,
https://github.com/fmtlib/fmt/pull/4612). Thanks @friedkeenan.
- Promoted `fmt::detail::named_arg` to the public API as `fmt::named_arg` and
deprecated the detail alias
(https://github.com/fmtlib/fmt/issues/4683,
https://github.com/fmtlib/fmt/pull/4687). Thanks @TPPPP72.
- Moved the `std::byte` formatter from `fmt/format.h` to `fmt/std.h`.
- Provided a default definition for `fmt::is_contiguous`
(https://github.com/fmtlib/fmt/pull/4731,
https://github.com/fmtlib/fmt/pull/4770). Thanks @user202729 and @phprus.
- Added the `FMT_USE_FLOCKFILE` macro to disable the use of `flockfile`
(https://github.com/fmtlib/fmt/issues/4646,
https://github.com/fmtlib/fmt/pull/4666). Thanks @mvastola.
- Added `include_guard(GLOBAL)` so that {fmt} can be used in multiple
submodules of the same project
(https://github.com/fmtlib/fmt/pull/4672). Thanks @torsten48.
- Improved `constexpr` support
(https://github.com/fmtlib/fmt/pull/4659,
https://github.com/fmtlib/fmt/pull/4591).
Thanks @elbeno and @17steen.
- Deprecated the implicit conversion from `fmt::format_string` and
`fmt::basic_fstring` to `string_view` to align with `std::format_string`;
use `format_string::get()` instead.
- Opted out `std::complex` from tuple formatting so that the dedicated
`std::complex` formatter is always used.
- Removed the `fmt::say` function.
- Deprecated the `std::initializer_list` overload of `fmt::join` and the array
overload of `fmt::vformat_to`.
- Made the `<fmt/core.h>` header equivalent to `<fmt/base.h>` by
default. Code that relied on `<fmt/core.h>` pulling in `<fmt/format.h>`
must now either include `<fmt/format.h>` directly or define
`FMT_DEPRECATED_HEAVY_CORE` to opt back in.
- Improved `wchar_t` support: `fmt::join` now accepts `wchar_t` and other
non-`char` separators, and `fmt::format_to_n` now works with `fmt::runtime`
on `wchar_t`
(https://github.com/fmtlib/fmt/pull/4686,
https://github.com/fmtlib/fmt/issues/4714,
https://github.com/fmtlib/fmt/pull/4715).
Thanks @Yancey2023 and @sunmy2019.
- Fixed formatting of `std::tm` with a null `tm_zone`
(https://github.com/fmtlib/fmt/pull/4790). Thanks @Carmel0.
- Fixed compile-time formatting in `fmt/ranges.h`, `fmt/style.h` and
`fmt/std.h` (https://github.com/fmtlib/fmt/pull/4759). Thanks @j4niwzis.
- Fixed an ambiguity between `formatter<std::optional<T>>` in `fmt/std.h`
and `fmt/ranges.h` on C++26 (P3168R2)
(https://github.com/fmtlib/fmt/pull/4761). Thanks @phprus.
- Fixed a GCC PCH breakage triggered by a scoped `#pragma GCC optimize`.
- Fixed a TSAN false positive in the locale handling code
(https://github.com/fmtlib/fmt/issues/4755).
- Fixed compile-time format string checks truncating string literals at
an embedded null byte
(https://github.com/fmtlib/fmt/pull/4732). Thanks @user202729.
- Fixed out-of-bounds reads in `printf` formatting
(https://github.com/fmtlib/fmt/issues/4741,
https://github.com/fmtlib/fmt/pull/4742,
https://github.com/fmtlib/fmt/pull/4800).
Thanks @Algunenano and @aizu-m.
- Fixed the return type of the `f(un)lockfile` wrappers on Windows
(https://github.com/fmtlib/fmt/pull/4739). Thanks @mvastola.
- Worked around a CUDA issue when handling UTF-32 literals
(https://github.com/fmtlib/fmt/pull/4719). Thanks @Cazadorro.
- Fixed missing named-argument validation for compiled format strings
(https://github.com/fmtlib/fmt/pull/4638). Thanks @JaeheonShim.
- Fixed `fmt::format_to_n` in `<fmt/compile.h>` failing to compile when
`<iterator>` is not transitively included
(https://github.com/fmtlib/fmt/issues/4615).
- Fixed handling of pointers in format string compilation with
`FMT_BUILTIN_TYPES=0`.
- Stopped assuming nul termination of the format string in `fmt::printf`.
Thanks @ZUENS2020 for reporting.
- Fixed a build error when locale support is disabled
(https://github.com/fmtlib/fmt/pull/4627). Thanks @marcel-behlau-elfin.
- Fixed a fallback range formatter for types with a `container_type` member
(https://github.com/fmtlib/fmt/issues/4123,
https://github.com/fmtlib/fmt/pull/4660). Thanks @Soumik15630m.
- Fixed C++20 concept detection
(https://github.com/fmtlib/fmt/pull/4653). Thanks @tearfur.
- Fixed a clang compilation failure
(https://github.com/fmtlib/fmt/pull/4718). Thanks @mccakit.
- Fixed various MSVC warnings, including C4305 and conversion warnings on
x86 (https://github.com/fmtlib/fmt/pull/4668,
https://github.com/fmtlib/fmt/pull/4594).
Thanks @kanren3 and @blizzard4591.
- Updated the Android Gradle Plugin to 9.x
(https://github.com/fmtlib/fmt/issues/4651,
https://github.com/fmtlib/fmt/pull/4658). Thanks @Soumik15630m.
- Made various code, build and test improvements
(https://github.com/fmtlib/fmt/pull/4625,
https://github.com/fmtlib/fmt/pull/4639,
https://github.com/fmtlib/fmt/pull/4644,
https://github.com/fmtlib/fmt/pull/4656,
https://github.com/fmtlib/fmt/pull/4680,
https://github.com/fmtlib/fmt/pull/4681,
https://github.com/fmtlib/fmt/pull/4704,
https://github.com/fmtlib/fmt/pull/4710,
https://github.com/fmtlib/fmt/pull/4713,
https://github.com/fmtlib/fmt/pull/4729,
https://github.com/fmtlib/fmt/pull/4751,
https://github.com/fmtlib/fmt/pull/4758,
https://github.com/fmtlib/fmt/pull/4799).
Thanks @ZephyrLykos, @togunchan, @kagancansit, @BerndPetrovitsch,
@Skylion007, @st0rmbtw, @localspook and @EXtremeExploit.
- Improved documentation, including a rewrite of the format string syntax,
better handling of doxygen tags, documenting `output_file`, fixing CSS so
that whitespace is displayed properly, and various smaller fixes
(https://github.com/fmtlib/fmt/pull/4622,
https://github.com/fmtlib/fmt/pull/4626,
https://github.com/fmtlib/fmt/pull/4631,
https://github.com/fmtlib/fmt/pull/4667,
https://github.com/fmtlib/fmt/pull/4616,
https://github.com/fmtlib/fmt/pull/4748).
Thanks @heavywatal, @ZephyrLykos, @user202729, @ssszcmawo, @bigmoonbit
and @Powerbyte7.
- Added building of release artifacts and SLSA provenance in CI, added a
CodeQL workflow, and added the security policy in `.github/SECURITY.md`.
fmtlib: update to 12.0.0.
# 12.0.0 - 2025-09-17
- Optimized the default floating point formatting
(https://github.com/fmtlib/fmt/issues/3675,
https://github.com/fmtlib/fmt/issues/4516). In particular, formatting a
`double` with format string compilation into a stack allocated buffer is
more than 60% faster in version 12.0 compared to 11.2 according to
[dtoa-benchmark](https://github.com/fmtlib/dtoa-benchmark):
```
Function Time (ns) Speedup
fmt11 34.471 1.00x
fmt12 21.000 1.64x
```
<img width="766" height="609" src="https://github.com/user-attachments/assets/d7d768ad-7543-468c-b0bb-449abf73b31b" />
- Added `constexpr` support to `fmt::format`. For example:
```c++
#include <fmt/compile.h>
using namespace fmt::literals;
std::string s = fmt::format(""_cf, 42);
```
now works at compile time provided that `std::string` supports `constexpr`
(https://github.com/fmtlib/fmt/issues/3403,
https://github.com/fmtlib/fmt/pull/4456). Thanks @msvetkin.
- Added `FMT_STATIC_FORMAT` that allows formatting into a string of the exact
required size at compile time.
For example:
```c++
#include <fmt/compile.h>
constexpr auto s = FMT_STATIC_FORMAT("{}", 42);
```
compiles to just
```s
__ZL1s:
.asciiz "42"
```
It can be accessed as a C string with `s.c_str()` or as a string view with
`s.str()`.
- Improved C++20 module support
- Switched to using estimated display width in precision. For example:
```c++
fmt::print("|{:.4}|\n|1234|\n", "🐱🐱🐱");
```
prints

because `🐱` has an estimated width of 2
- Fix interaction between debug presentation, precision, and width for strings
- Implemented allocator propagation on `basic_memory_buffer` move
- Fixed an ambiguity between `std::reference_wrapper<T>` and `format_as`
formatters
- Removed the following deprecated APIs:
- `has_formatter`: use `is_formattable` instead,
- `basic_format_args::parse_context_type`,
`basic_format_args::formatter_type` and similar aliases in context types,
- wide stream overload of `fmt::printf`,
- wide stream overloads of `fmt::print` that take text styles,
- `is_*char` traits,
- `fmt::localtime`.
- Deprecated wide overloads of `fmt::fprintf` and `fmt::sprintf`.
- Improved diagnostics for the incorrect usage of `fmt::ptr`
- Made handling of ANSI escape sequences more efficient
- Fixed a buffer overflow on all emphasis flags set
- Fixed an integer overflow for precision close to the max `int` value.
- Fixed compatibility with WASI (https://github.com/fmtlib/fmt/issues/4496,
- Fixed `back_insert_iterator` detection, preventing a fallback on slower path
that handles arbitrary iterators
- Fixed handling of invalid glibc `FILE` buffers
- Added `wchar_t` support to the `std::byte` formatter
- Changed component prefix from `fmt-` to `fmt_` for compatibility with
NSIS/CPack on Windows, e.g. `fmt-doc` changed to `fmt_doc`
- Added the `FMT_CUSTOM_ASSERT_FAIL` macro to simplify providing a custom
`fmt::assert_fail` implementation
- Switched to `FMT_THROW` on reporting format errors so that it can be
overriden by users when exceptions are disabled
- Improved master project detection and disabled install targets when using
{fmt} as a subproject by default
- Made various code improvements
- Added Conan instructions to the docs
- Removed Bazel files to avoid issues with downstream packaging
- Added more entries for generated files to `.gitignore`
- Fixed various warnings and compilation issues
Update fmtlib to 11.0.1 Many improvemnts. Highlights include: - Added formatters for `std::chrono::day`, `std::chrono::month`, `std::chrono::year` and `std::chrono::year_month_day` - Fixed handling of precision in `%S` (https://github.com/fmtlib/fmt/issues/3794, - Added a formatter for `std::complex` - Added a formatter for `std::expected` - Added a formatter for `std::type_info` and much faster compile times even without using the new cut down fmt/base.h which provides the printf() equivalent family of functions. For a full list see https://github.com/fmtlib/fmt/blob/11.0.1/ChangeLog.md
fmtlib: updated to 10.2.1
10.2.1 - 2024-01-03
- Fixed ABI compatibility with earlier 10.x versions
10.2.0 - 2024-01-01
- Added support for the `%j` specifier (the number of days) for
`std::chrono::duration`
- Added support for the chrono suffix for days and changed
the suffix for minutes from "m" to the correct "min"
For example ([godbolt](https://godbolt.org/z/9KhMnq9ba)):
```c++
#include <fmt/chrono.h>
int main() {
fmt::print("{}\n", std::chrono::days(42)); // prints "42d"
}
```
- Fixed an overflow in `std::chrono::time_point` formatting with large dates
- Added a formatter for `std::source_location`
For example ([godbolt](https://godbolt.org/z/YajfKjhhr)):
```c++
#include <source_location>
#include <fmt/std.h>
int main() {
fmt::print("{}\n", std::source_location::current());
}
```
prints
```
/app/example.cpp:5:51: int main()
```
- Added a formatter for `std::bitset`
```c++
#include <bitset>
#include <fmt/std.h>
int main() {
fmt::print("{}\n", std::bitset<6>(42)); // prints "101010"
}
```
- Added an experimental `nested_formatter` that provides an easy way of
applying a formatter to one or more subobjects while automatically handling
width, fill and alignment. For example:
```c++
#include <fmt/format.h>
struct point {
double x, y;
};
template <>
struct fmt::formatter<point> : nested_formatter<double> {
auto format(point p, format_context& ctx) const {
return write_padded(ctx, [=](auto out) {
return format_to(out, "({}, {})", nested(p.x), nested(p.y));
});
}
};
int main() {
fmt::print("[{:>20.2f}]", point{1, 2});
}
```
prints
```
[ (1.00, 2.00)]
```
- Added the generic representation (`g`) to `std::filesystem::path`
```c++
#include <filesystem>
#include <fmt/std.h>
int main() {
fmt::print("{:g}\n", std::filesystem::path("C:\\foo"));
}
```
prints `"C:/foo"` on Windows.
- Made `format_as` work with references
- Fixed formatting of invalid UTF-8 with precision
- Fixed an inconsistency between `fmt::to_string` and `fmt::format`
- Disallowed unsafe uses of `fmt::styled`
```c++
auto s = fmt::styled(std::string("dangle"), fmt::emphasis::bold);
fmt::print("{}\n", s); // compile error
```
Pass `fmt::styled(...)` as a parameter instead.
- Added a null check when formatting a C string with the `s` specifier
- Disallowed the `c` specifier for `bool`
- Made the default formatting unlocalized in `fmt::ostream_formatter` for
consistency with the rest of the library
- Fixed localized formatting in bases other than decimal
- Fixed a performance regression in experimental `fmt::ostream::print`
- Added synchronization with the underlying output stream when writing to
the Windows console
- Changed to only export `format_error` when {fmt} is built as a shared
library
- Made `fmt::streamed` `constexpr`.
- Enabled `consteval` on older versions of MSVC
- Added an option to build without `wchar_t` support on Windows
- Improved build and CI configuration
- Fixed various warnings, compilation and test issues
- Improved documentation and README
- Updated CI dependencies
fmtlib: updated to 10.1.1 10.1.1 Added formatters for std::atomic and atomic_flag Fixed an error about partial specialization of formatter<string> after instantiation when compiled with gcc and C++20 Fixed compilation as a C++20 module with gcc and clang Made fmt::to_string work with types that have format_as overloads Made formatted_size work with integral format specifiers at compile time Fixed a warning about the no_unique_address attribute on clang-cl Improved compatibility with the legacy GBK encoding Added OpenSSF Scorecard analysis Updated CI dependencies
fmtlib: update to 10.0.0.
10.0.0 - 2023-05-09
-------------------
* Replaced Grisu with a new floating-point formatting algorithm for given
precision
The new algorithm is based on Dragonbox already used for the
shortest representation and gives substantial performance improvement:
* Replaced ``snprintf``-based hex float formatter with an internal
implementation
This removes the last usage of ``s(n)printf`` in {fmt}.
* Fixed alignment of floating-point numbers with localization
* Improved C++20 module support
Switched to the `modules CMake library <https://github.com/vitaut/modules>`_
which allows building {fmt} as a C++20 module with clang::
CXX=clang++ cmake -DFMT_MODULE=ON .
make
* Made ``format_as`` work with any user-defined type and not just enums.
For example (`godbolt <https://godbolt.org/z/b7rqhq5Kh>`__):
.. code:: c++
#include <fmt/format.h>
struct floaty_mc_floatface {
double value;
};
auto format_as(floaty_mc_floatface f) { return f.value; }
int main() {
fmt::print("{:8}\n", floaty_mc_floatface{0.42}); // prints " 0.42"
}
* Removed deprecated implicit conversions for enums and conversions to primitive
types for compatibility with ``std::format`` and to prevent potential ODR
violations. Use ``format_as`` instead.
* Added support for fill, align and width to the time point formatter
* Implemented formatting of subseconds
* Added precision support to ``%S``
* Added support for ``std::utc_time``
* Switched formatting of ``std::chrono::system_clock`` from local time to UTC
for compatibility with the standard
* Added support for ``%Ez`` and ``%Oz`` to chrono formatters.
* Improved validation of format specifiers for ``std::chrono::duration``
* Fixed formatting of time points before the epoch
* Experimental: implemented glibc extension for padding seconds, minutes and
hours
* Added a formatter for ``std::exception``
* Moved ``std::error_code`` formatter from ``fmt/os.h`` to ``fmt/std.h``.
* Added formatters for standard container adapters: ``std::priority_queue``,
``std::queue`` and ``std::stack``
* Added a formatter for ``std::optional`` to ``fmt/std.h``.
* Fixed formatting of valueless by exception variants
* Made ``fmt::ptr`` accept ``unique_ptr`` with a custom deleter
* Fixed formatting of noncopyable ranges and nested ranges of chars
* Fixed issues with formatting of paths and ranges of paths
* Improved handling of invalid Unicode in paths.
* Enabled compile-time checks on Apple clang 14 and later
* Improved compile-time checks of named arguments
* Fixed formatting when both alignment and ``0`` are given
* Improved Unicode support in the experimental file API on Windows
* Unified UTF transcoding
* Added support for UTF-8 digit separators via an experimental locale facet
* Added an overload of ``formatted_size`` that takes a locale
* Removed the deprecated ``FMT_DEPRECATED_OSTREAM``.
* Fixed a UB when using a null ``std::string_view`` with ``fmt::to_string``
or format string compilation
* Added ``starts_with`` to the fallback ``string_view`` implementation
* Added ``fmt::basic_format_string::get()`` for compatibility with
``basic_format_string``
* Added ``println`` for compatibility with C++23
* Improved documentation
* Improved build configuration and tests
* Fixed a regression in handling empty format specifiers after a colon (``{:}``)
* Worked around a broken implementation of ``std::is_constant_evaluated`` in
some versions of libstdc++ on clang
* Fixed formatting of volatile variables
* Fixed various warnings and compilation issues
fmtlib: update to 9.1.0
From Wongboo via Github pull request.
Closes NetBSD/pkgsrc#111.
9.1.0 - 2022-08-27
------------------
* ``fmt::formatted_size`` now works at compile time
. For example
(`godbolt <https://godbolt.org/z/1MW5rMdf8>`__):
.. code:: c++
#include <fmt/compile.h>
int main() {
using namespace fmt::literals;
constexpr size_t n = fmt::formatted_size("{}"_cf, 42);
fmt::print("{}\n", n); // prints 2
}
* Fixed handling of invalid UTF-8.
* Improved Unicode support in ``ostream`` overloads of ``print``.
* Fixed handling of the sign specifier in localized formatting on systems with
32-bit ``wchar_t`` .
* Added support for wide streams to ``fmt::streamed``.
* Added the ``n`` specifier that disables the output of delimiters when
formatting ranges.
For example (`godbolt <https://godbolt.org/z/roKqGdj8c>`__):
.. code:: c++
#include <fmt/ranges.h>
#include <vector>
int main() {
auto v = std::vector{1, 2, 3};
fmt::print("{:n}\n", v); // prints 1, 2, 3
}
* Worked around problematic ``std::string_view`` constructors introduced in
C++23
* Improve handling (exclusion) of recursive ranges
* Improved error reporting in format string compilation.
* Improved the implementation of
`Dragonbox <https://github.com/jk-jeon/dragonbox>`_, the algorithm used for
the default floating-point formatting.
* Fixed issues with floating-point formatting on exotic platforms.
* Improved the implementation of chrono formatting.
* Improved documentation.
* Improved build configuration.
* Fixed various warnings and compilation issues.
9.0.0 - 2022-07-04
------------------
* Switched to the internal floating point formatter for all decimal presentation
formats. In particular this results in consistent rounding on all platforms
and removing the ``s[n]printf`` fallback for decimal FP formatting.
* Compile-time floating point formatting no longer requires the header-only
mode. For example (`godbolt <https://godbolt.org/z/G37PTeG3b>`__):
.. code:: c++
#include <array>
#include <fmt/compile.h>
consteval auto compile_time_dtoa(double value) -> std::array<char, 10> {
auto result = std::array<char, 10>();
fmt::format_to(result.data(), FMT_COMPILE("{}"), value);
return result;
}
constexpr auto answer = compile_time_dtoa(0.42);
works with the default settings.
* Improved the implementation of
`Dragonbox <https://github.com/jk-jeon/dragonbox>`_, the algorithm used for
the default floating-point formatting.
* Made ``fmt::to_string`` work with ``__float128``. This uses the internal
FP formatter and works even on system without ``__float128`` support in
``[s]printf``.
* Disabled automatic ``std::ostream`` insertion operator (``operator<<``)
discovery when ``fmt/ostream.h`` is included to prevent ODR violations.
You can get the old behavior by defining ``FMT_DEPRECATED_OSTREAM`` but this
will be removed in the next major release. Use ``fmt::streamed`` or
``fmt::ostream_formatter`` to enable formatting via ``std::ostream`` instead.
* Added ``fmt::ostream_formatter`` that can be used to write ``formatter``
specializations that perform formatting via ``std::ostream``.
For example (`godbolt <https://godbolt.org/z/5sEc5qMsf>`__):
.. code:: c++
#include <fmt/ostream.h>
struct date {
int year, month, day;
friend std::ostream& operator<<(std::ostream& os, const date& d) {
return os << d.year << '-' << d.month << '-' << d.day;
}
};
template <> struct fmt::formatter<date> : ostream_formatter {};
std::string s = fmt::format("The date is {}", date{2012, 12, 9});
// s == "The date is 2012-12-9"
* Added the ``fmt::streamed`` function that takes an object and formats it
via ``std::ostream``.
For example (`godbolt <https://godbolt.org/z/5G3346G1f>`__):
.. code:: c++
#include <thread>
#include <fmt/ostream.h>
int main() {
fmt::print("Current thread id: {}\n",
fmt::streamed(std::this_thread::get_id()));
}
Note that ``fmt/std.h`` provides a ``formatter`` specialization for
``std::thread::id`` so you don't need to format it via ``std::ostream``.
* Deprecated implicit conversions of unscoped enums to integers for consistency
with scoped enums.
* Added an argument-dependent lookup based ``format_as`` extension API to
simplify formatting of enums.
* Added experimental ``std::variant`` formatting support.
For example (`godbolt <https://godbolt.org/z/KG9z6cq68>`__):
.. code:: c++
#include <variant>
#include <fmt/std.h>
int main() {
auto v = std::variant<int, std::string>(42);
fmt::print("{}\n", v);
}
prints::
variant(42)
Thanks `@jehelset <https://github.com/jehelset>`_.
* Added experimental ``std::filesystem::path`` formatting support
(`#2865 <https://github.com/fmtlib/fmt/issues/2865>`_,
`#2902 <https://github.com/fmtlib/fmt/pull/2902>`_,
`#2917 <https://github.com/fmtlib/fmt/issues/2917>`_,
`#2918 <https://github.com/fmtlib/fmt/pull/2918>`_).
For example (`godbolt <https://godbolt.org/z/o44dMexEb>`__):
.. code:: c++
#include <filesystem>
#include <fmt/std.h>
int main() {
fmt::print("There is no place like {}.", std::filesystem::path("/home"));
}
prints::
There is no place like "/home".
* Added a ``std::thread::id`` formatter to ``fmt/std.h``.
For example (`godbolt <https://godbolt.org/z/j1azbYf3E>`__):
.. code:: c++
#include <thread>
#include <fmt/std.h>
int main() {
fmt::print("Current thread id: {}\n", std::this_thread::get_id());
}
* Added ``fmt::styled`` that applies a text style to an individual argument.
.
For example (`godbolt <https://godbolt.org/z/vWGW7v5M6>`__):
.. code:: c++
#include <fmt/chrono.h>
#include <fmt/color.h>
int main() {
auto now = std::chrono::system_clock::now();
fmt::print(
"[{}] {}: {}\n",
fmt::styled(now, fmt::emphasis::bold),
fmt::styled("error", fg(fmt::color::red)),
"something went wrong");
}
* Made ``fmt::print`` overload for text styles correctly handle UTF-8.
* Fixed Unicode handling when writing to an ostream.
* Added support for nested specifiers to range formatting:
.. code:: c++
#include <vector>
#include <fmt/ranges.h>
int main() {
fmt::print("{::#x}\n", std::vector{10, 20, 30});
}
prints ``[0xa, 0x14, 0x1e]``.
* Implemented escaping of wide strings in ranges.
* Added support for ranges with ``begin`` / ``end`` found via the
argument-dependent lookup.
* Fixed formatting of certain kinds of ranges of ranges.
* Fixed handling of maps with element types other than ``std::pair``.
* Made tuple formatter enabled only if elements are formattable.
* Made ``fmt::join`` compatible with format string compilation.
* Made compile-time checks work with named arguments of custom types and
``std::ostream`` ``print`` overloads.
* Removed ``make_args_checked`` because it is no longer needed for compile-time.
* Removed the following deprecated APIs: ``_format``, ``arg_join``,
the ``format_to`` overload that takes a memory buffer,
``[v]fprintf`` that takes an ``ostream``.
* Removed the deprecated implicit conversion of ``[const] signed char*`` and
``[const] unsigned char*`` to C strings.
* Removed the deprecated ``fmt/locale.h``.
* Replaced the deprecated ``fileno()`` with ``descriptor()`` in
``buffered_file``.
* Moved ``to_string_view`` to the ``detail`` namespace since it's an
implementation detail.
* Made access mode of a created file consistent with ``fopen`` by setting
``S_IWGRP`` and ``S_IWOTH``.
* Removed a redundant buffer resize when formatting to ``std::ostream``.
* Made precision computation for strings consistent with width.
.
* Fixed handling of locale separators in floating point formatting.
* Made sign specifiers work with ``__int128_t``.
* Improved support for systems such as CHERI with extra data stored in pointers.
* Improved documentation.
* Improved build configuration.
* Fixed various warnings and compilation issues.
fmtlib: updated to 8.0.1
8.0.1:
Fixed the version number in the inline namespace
Added a missing presentation type check for std::string
Fixed a linkage error when mixing code built with clang and gcc
Fixed documentation issues
Removed dead code in FP formatter
Fixed various warnings and compilation issues
8.0.0:
Enabled compile-time format string check by default.
Added compile-time formatting
Optimized handling of format specifiers during format string compilation. For example, hexadecimal formatting ("{:x}") is now 3-7x faster than before when using format_to with format string compilation and a stack-allocated buffer
Added the _cf user-defined literal to represent a compiled format string. It can be used instead of the FMT_COMPILE macro
Format string compilation now requires format functions of formatter specializations for user-defined types to be const
Added UDL-based named argument support to format string compilation
Added format string compilation support to fmt::print
Added initial support for compiling {fmt} as a C++20 module
Made symbols private by default reducing shared library size. For example there was a ~15% reported reduction on one platform
Optimized includes making the result of preprocessing fmt/format.h ~20% smaller with libstdc++/C++20 and slightly improving build times
Added support of ranges with non-const begin / end
Added support of std::byte and other formattable types to fmt::join
Implemented the default format for std::chrono::system_clock
Made more chrono specifiers locale independent by default. Use the 'L' specifier to get localized formatting.
Improved locale handling in chrono formatting
(textproc/fmtlib) regen PLIST
fmtlib: updated to 6.2.0 6.2.0: * Improved error reporting when trying to format an object of a non-formattable type * Reduced library size by ~10%. * Always print decimal point if # is specified * Implemented the 'L' specifier for locale-specific numeric formatting to improve compatibility with std::format. The 'n' specifier is now deprecated and will be removed in the next major release. * Moved OS-specific APIs such as windows_error from fmt/format.h to fmt/os.h. You can define FMT_DEPRECATED_INCLUDE_OS to automatically include fmt/os.h from fmt/format.h for compatibility but this will be disabled in the next major release. * Added precision overflow detection in floating-point formatting. * Implemented detection of invalid use of fmt::arg. * Used type_identity to block unnecessary template argument deduction. * Improved UTF-8 handling * Added experimental dynamic argument storage * Made fmt::join accept initializer_list * Fixed handling of empty tuples * Fixed handling of output iterators in format_to_n * Fixed formatting of std::chrono::duration types to wide output * Added const begin and end overload to buffers * Added the ability to disable floating-point formatting via FMT_USE_FLOAT, FMT_USE_DOUBLE and FMT_USE_LONG_DOUBLE macros for extremely memory-constrained embedded system * Made FMT_STRING work with constexpr string_view * Implemented a minor optimization in the format string parser * Improved attribute detection * Improved documentation * Fixed symbol visibility on Linux when compiling with -fvisibility=hidden * Implemented various build configuration fixes and improvements * Fixed various warnings and compilation issues
fmtlib: updated to 6.1.1
6.1.1:
Fixed shared library build on Windows.
Added a missing decimal point in exponent notation with trailing zeros.
Removed deprecated format_arg_store::TYPES.
6.1.0:
{fmt} now formats IEEE 754 float and double using the shortest decimal representation with correct rounding by default.
Made the fast binary to decimal floating-point formatter the default, simplified it and improved performance. {fmt} is now 15 times faster than libc++'s std::ostringstream, 11 times faster than printf and 10% faster than double-conversion on dtoa-benchmark.
{fmt} no longer converts float arguments to double. In particular this improves the default (shortest) representation of floats and makes fmt::format consistent with std::for.
Made floating-point formatting output consistent with printf/iostreams.
Added support for 128-bit integers.
The overload of print that takes text_style is now atomic, i.e. the output from different threads doesn't interleave.
Made compile time in the header-only mode ~20% faster by reducing the number of template instantiations. wchar_t overload of vprint was moved from fmt/core.h to fmt/format.h.
Added an overload of fmt::join that works with tuples.
Changed formatting of octal zero with prefix from "00" to "0.
The locale is now passed to ostream insertion (<<) operators.
Locale-specific number formatting now uses groupin.
Fixed handling of types with deleted implicit rvalue conversion to const char**.
Enums are now mapped to correct underlying types instead of int.
Enum classes are no longer implicitly converted to int.
Added basic_format_parse_context for consistency with C++20 std::format and deprecated basic_parse_context.
Fixed handling of UTF-8 in precision.
{fmt} can now be installed on Linux, macOS and Windows with Conda using its conda-forge package.
Added a CUDA test.
fmtlib: updated to 6.0.0 6.0.0: Switched to the MIT license with an optional exception that allows distributing binary code without attribution. Floating-point formatting is now locale-independent by default. Added an experimental Grisu floating-point formatting algorithm implementation (disabled by default). To enable it compile with the FMT_USE_GRISU macro defined to 1. Separated formatting and parsing contexts for consistency with C++20 std::format, removing the undocumented basic_format_context::parse_context() function. Added oss-fuzz support. formatter specializations now always take precedence over operator<<. Introduced the experimental fmt::compile function that does format string compilation. Added the % format specifier that formats floating-point values as percentages. Implemented precision for floating-point durations. Implemented chrono format specifiers %Q and %q that give the value and the unit respectively . Fixed handling of dynamic width in chrono formatter. Removed deprecated fmt/time.h. Use fmt/chrono.h instead. Added fmt::format and fmt::vformat overloads that take text_style. Removed the deprecated color API (print_colored). Use the new API, namely print overloads that take text_style instead. Made std::unique_ptr and std::shared_ptr formattable as pointers via fmt::ptr. Made print and vprint report I/O errors. Marked deprecated APIs with the [[deprecated]] attribute and removed internal uses of deprecated APIs. Modernized the codebase using more C++11 features and removing workarounds. Most importantly, buffer_context is now an alias template, so use buffer_context<T> instead of buffer_context<T>::type. These features require GCC 4.8 or later. formatter specializations now always take precedence over implicit conversions to int and the undocumented convert_to_int trait is now deprecated. Moved the undocumented basic_writer, writer, and wwriter types to the internal namespace. Removed deprecated basic_format_context::begin(). Use out() instead. Disallowed passing the result of join as an lvalue to prevent misuse. Refactored the undocumented structs that represent parsed format specifiers to simplify the API and allow multibyte fill. Moved SFINAE to template parameters to reduce symbol sizes. Switched to fputws for writing wide strings so that it's no longer required to call _setmode on Windows.
fmtlib: updated to 5.3.0 5.3.0: * Introduced experimental chrono formatting support * Added experimental support for emphasis (bold, italic, underline, strikethrough), colored output to a file stream, and improved colored formatting API * Added support for 4-bit terminal colors * Parameterized formatting functions on the type of the format string. Any object of type S that has an overloaded to_string_view(const S&) returning fmt::string_view can be used as a format string * Made std::string_view work as a format string * Added wide string support to compile-time format string checks * Made colored print functions work with wide strings * Introduced experimental Unicode support * Improved locale support * Constrained formatting functions on proper iterator types * Added make_printf_args and make_wprintf_args functions * Deprecated fmt::visit, parse_context, and wparse_context. Use fmt::visit_format_arg, format_parse_context, and wformat_parse_context instead. * Removed undocumented basic_fixed_buffer which has been superseded by the iterator-based API * Disallowed repeated leading zeros in an argument ID * Reintroduced support for gcc 4.4 * Fixed compilation on platforms with exotic double * Improved documentation * Added pkgconfig support which makes it easier to consume the library from meson and other build systems
fmtlib: added version 5.2.1 fmt (formerly cppformat) is an open-source formatting library. It can be used as a fast and safe alternative to printf and IOStreams.