From 39b51b2d4c672f0573e66478d9e08654e6ea7bf7 Mon Sep 17 00:00:00 2001 From: mjk Date: Fri, 19 Mar 2021 23:52:24 +0000 Subject: [PATCH] make glib::impl::varstring less explosive --- plugins/windows-notification/api/include/ginvoke.hpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/windows-notification/api/include/ginvoke.hpp b/plugins/windows-notification/api/include/ginvoke.hpp index 141dd8a4..3d1375aa 100644 --- a/plugins/windows-notification/api/include/ginvoke.hpp +++ b/plugins/windows-notification/api/include/ginvoke.hpp @@ -31,6 +31,12 @@ namespace impl using varstring_t = std::variant; struct varstring : varstring_t { + varstring(std::string &&s) noexcept : varstring_t{std::move(s)} {} + varstring(static_c_str &&s) noexcept : varstring_t{std::move(s)} {} + varstring(std::nullptr_t) = delete; + varstring(const varstring &) = delete; + varstring(varstring &&) = default; + const char* c_str() const && = delete; const char* c_str() const & { @@ -75,7 +81,7 @@ inline impl::varstring describe_arguments(const Arg &... a) noexcept try ((describe_argument(ss,a) << ','), ...); auto s = std::move(ss).str(); s.pop_back(); - return {s}; + return {std::move(s)}; } catch (...) {