From 1c37b0487c7d96c99c08cc8989c787283143e8a7 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 15 Mar 2023 17:25:00 +0100 Subject: [PATCH] lib/fmt/SystemError: add VFmtErrno() --- src/lib/fmt/SystemError.hxx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lib/fmt/SystemError.hxx b/src/lib/fmt/SystemError.hxx index 8ee2efe3b3..a53e26ec27 100644 --- a/src/lib/fmt/SystemError.hxx +++ b/src/lib/fmt/SystemError.hxx @@ -67,6 +67,15 @@ FmtLastError(const S &format_str, Args&&... args) noexcept #endif // _WIN32 +[[nodiscard]] [[gnu::pure]] +inline std::system_error +VFmtErrno(int code, + fmt::string_view format_str, fmt::format_args args) noexcept +{ + return VFmtSystemError(std::error_code(code, ErrnoCategory()), + format_str, args); +} + template requires(std::is_convertible_v) [[nodiscard]] [[gnu::pure]]