Path to this page:
Subject: CVS commit: pkgsrc/textproc/fmtlib
From: Adam Ciarcinski
Date: 2024-01-04 19:42:57
Message id: 20240104184257.B2C72FA42@cvs.NetBSD.org
Log Message:
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
Files: