From 7fcbd6e474235957f2785c3d9b5344b2acf3ff77 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Thu, 4 Jun 2026 22:39:44 +0200 Subject: upgrade to std::string_view --- include/winapi/handle.hpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'include/winapi/handle.hpp') diff --git a/include/winapi/handle.hpp b/include/winapi/handle.hpp index b5a7547..7af7252 100644 --- a/include/winapi/handle.hpp +++ b/include/winapi/handle.hpp @@ -11,7 +11,7 @@ #include #include -#include +#include #include namespace winapi { @@ -69,14 +69,23 @@ public: * @param buffer Binary data to write. */ void write(const Buffer& buffer) const; - /** * Write data to this handle. * @param src Binary data to write. */ template - void write(const std::basic_string& src) const { - write(src.c_str(), src.size() * sizeof(CharT)); + void write(std::basic_string_view src) const { + write(src.data(), src.length() * sizeof(CharT)); + } + /** + * Write data to this handle. + * @param src Binary data to write. + */ + template , + typename Allocator = std::allocator> + void write(const std::basic_string src) const { + write(std::basic_string_view{src}); } void inherit(bool yes = true) const; -- cgit v1.3