make glib::impl::varstring less explosive
This commit is contained in:
parent
7cb6b3f4b3
commit
39b51b2d4c
|
@ -31,6 +31,12 @@ namespace impl
|
||||||
using varstring_t = std::variant<std::string, static_c_str>;
|
using varstring_t = std::variant<std::string, static_c_str>;
|
||||||
struct varstring : varstring_t
|
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 && = delete;
|
||||||
const char* c_str() const &
|
const char* c_str() const &
|
||||||
{
|
{
|
||||||
|
@ -75,7 +81,7 @@ inline impl::varstring describe_arguments(const Arg &... a) noexcept try
|
||||||
((describe_argument(ss,a) << ','), ...);
|
((describe_argument(ss,a) << ','), ...);
|
||||||
auto s = std::move(ss).str();
|
auto s = std::move(ss).str();
|
||||||
s.pop_back();
|
s.pop_back();
|
||||||
return {s};
|
return {std::move(s)};
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue