diff options
| author | Egor Tensin <egor@tensin.name> | 2026-06-04 23:00:02 +0200 |
|---|---|---|
| committer | Egor Tensin <egor@tensin.name> | 2026-06-04 23:00:02 +0200 |
| commit | 3333f7cc6e5bee683ae7349ed86304e20db5a675 (patch) | |
| tree | 81d2d574b9a21af6f9e56325fba8dc418ad7b3e3 /src/error.cpp | |
| parent | upgrade to std::optional (diff) | |
| download | winapi-common-3333f7cc6e5bee683ae7349ed86304e20db5a675.tar.gz winapi-common-3333f7cc6e5bee683ae7349ed86304e20db5a675.zip | |
upgrade to std::format
Diffstat (limited to 'src/error.cpp')
| -rw-r--r-- | src/error.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/error.cpp b/src/error.cpp index 3fd18ea..afc33f3 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -9,7 +9,7 @@ #include <windows.h> #include <cstdint> -#include <sstream> +#include <format> #include <string> #include <string_view> #include <system_error> @@ -27,9 +27,7 @@ std::wstring trim_trailing_newline(std::wstring_view s) { } std::string build_what(DWORD code, std::string_view function) { - std::ostringstream what; - what << "Function " << function << " failed with error code " << code; - return what.str(); + return std::format("Function {} failed with error code {}", function, code); } std::string format_message(int32_t code) { |
