From 3333f7cc6e5bee683ae7349ed86304e20db5a675 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Thu, 4 Jun 2026 23:00:02 +0200 Subject: upgrade to std::format --- include/winapi/buffer.hpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'include/winapi/buffer.hpp') diff --git a/include/winapi/buffer.hpp b/include/winapi/buffer.hpp index bebd05f..1009ebb 100644 --- a/include/winapi/buffer.hpp +++ b/include/winapi/buffer.hpp @@ -7,8 +7,8 @@ #include #include +#include #include -#include #include #include #include @@ -67,11 +67,8 @@ public: std::wstring as_utf16() const { const auto c_str = reinterpret_cast(data()); const auto nb = size(); - if (nb % 2 != 0) { - std::ostringstream oss; - oss << "Buffer size invalid at " << nb << " bytes"; - throw std::runtime_error{oss.str()}; - } + if (nb % 2 != 0) + throw std::runtime_error{std::format("Buffer size invalid at {} bytes", nb)}; const auto nch = nb / 2; return {c_str, nch}; } -- cgit v1.3