114e462669
We received a request from our localization team to switch from printf-style format strings (%s, %u) to format strings with positional argument support. I've been hoping for a long time to take a dependency on C++20's std::format, but we're just not somewhere we can do that. Enter fmt. fmt is _exactly_ the library we need. Minor comparison: std::wstring_view world = /* ... */; auto str{ wil::str_printf<std::wstring>(L"hello %.*s", gsl::narrow_cast<size_t>(world.size()), world.data()) }; --- auto str{ fmt::format(L"hello {0}", world) }; If you really want to use the print specifiers: auto str{ fmt::printf(L"hello %s", world) }; It's got optional compile-time checking for format strings and is MIT-licensed. Eventually, we should be able to replace fmt:: with std:: and end up pretty much where we left off. What more could you ask for? |
||
---|---|---|
.. | ||
fmt |