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/shmem.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'include/winapi/shmem.hpp') diff --git a/include/winapi/shmem.hpp b/include/winapi/shmem.hpp index 4040241..3290cf3 100644 --- a/include/winapi/shmem.hpp +++ b/include/winapi/shmem.hpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include @@ -23,12 +23,12 @@ public: * @param name UTF-8 string. * @param nb Number of bytes. */ - static SharedMemory create(const std::string& name, std::size_t nb); + static SharedMemory create(std::string_view name, std::size_t nb); /** * Opens a shared memory region. * @param name UTF-8 string. */ - static SharedMemory open(const std::string& name); + static SharedMemory open(std::string_view name); /** Get pointer to the data. */ void* get() const { return m_addr.get(); } @@ -60,7 +60,7 @@ public: * @param args Arguments to construct the object. */ template - static SharedObject create(const std::string& name, Args&&... args) { + static SharedObject create(std::string_view name, Args&&... args) { SharedObject obj{SharedMemory::create(name, sizeof(AlignedType))}; new (obj.ptr()) T(std::forward(args)...); obj.m_destruct = true; @@ -71,7 +71,7 @@ public: * Open a shared memory region that stores the object. * @param name UTF-8 string, name of the shared memory region. */ - static SharedObject open(const std::string& name) { + static SharedObject open(std::string_view name) { SharedObject obj{SharedMemory::open(name)}; return obj; } -- cgit v1.3