diff --git a/hecl/include/hecl/hecl.hpp b/hecl/include/hecl/hecl.hpp index 97a8b2b73..11ec97404 100644 --- a/hecl/include/hecl/hecl.hpp +++ b/hecl/include/hecl/hecl.hpp @@ -115,7 +115,9 @@ public: const char* c_str() const { return m_utf8.c_str(); } std::string operator+(std::string_view other) const { return m_utf8 + other.data(); } }; -inline std::string operator+(std::string_view lhs, const SystemUTF8Conv& rhs) { return std::string(lhs) + rhs.c_str(); } +inline std::string operator+(std::string_view lhs, const SystemUTF8Conv& rhs) { + return std::string(lhs).append(rhs.str()); +} class SystemStringConv { std::wstring m_sys; @@ -126,7 +128,7 @@ public: std::wstring operator+(const std::wstring_view other) const { return m_sys + other.data(); } }; inline std::wstring operator+(std::wstring_view lhs, const SystemStringConv& rhs) { - return std::wstring(lhs) + rhs.c_str(); + return std::wstring(lhs).append(rhs.sys_str()); } #else class SystemUTF8Conv { @@ -136,9 +138,11 @@ public: explicit SystemUTF8Conv(SystemStringView str) : m_utf8(str) {} std::string_view str() const { return m_utf8; } const char* c_str() const { return m_utf8.data(); } - std::string operator+(std::string_view other) const { return std::string(m_utf8) + other.data(); } + std::string operator+(std::string_view other) const { return std::string(m_utf8).append(other); } }; -inline std::string operator+(std::string_view lhs, const SystemUTF8Conv& rhs) { return std::string(lhs) + rhs.c_str(); } +inline std::string operator+(std::string_view lhs, const SystemUTF8Conv& rhs) { + return std::string(lhs).append(rhs.str()); +} class SystemStringConv { std::string_view m_sys; @@ -146,10 +150,10 @@ public: explicit SystemStringConv(std::string_view str) : m_sys(str) {} SystemStringView sys_str() const { return m_sys; } const SystemChar* c_str() const { return m_sys.data(); } - std::string operator+(std::string_view other) const { return std::string(m_sys) + other.data(); } + std::string operator+(std::string_view other) const { return std::string(m_sys).append(other); } }; inline std::string operator+(std::string_view lhs, const SystemStringConv& rhs) { - return std::string(lhs) + rhs.c_str(); + return std::string(lhs).append(rhs.sys_str()); } #endif