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? |
||
---|---|---|
.. | ||
CppCoreCheck | ||
test | ||
til | ||
argb.h | ||
conattrs.hpp | ||
conime.h | ||
conint.h | ||
conpty-static.h | ||
conpty.h | ||
consoletaeftemplates.hpp | ||
contsf.h | ||
cpl_core.h | ||
DefaultSettings.h | ||
HostAndPropsheetIncludes.h | ||
IDefaultColorProvider.hpp | ||
ITerminalOutputConnection.hpp | ||
ITerminalOwner.hpp | ||
LibraryIncludes.h | ||
operators.hpp | ||
til.h | ||
unicode.hpp | ||
VtIoModes.hpp |