diff --git a/deps/ox/src/ox/std/string.hpp b/deps/ox/src/ox/std/string.hpp index e44e7f10..e05e3e14 100644 --- a/deps/ox/src/ox/std/string.hpp +++ b/deps/ox/src/ox/std/string.hpp @@ -30,7 +30,7 @@ constexpr ox::IString<21> itoa(Integer v) noexcept; template class BasicString { private: - Vector m_buff; + Vector m_buff{1}; public: static constexpr auto SmallStringSize = SmallStringSize_v; @@ -248,21 +248,10 @@ class BasicString { }; template -constexpr BasicString::BasicString() noexcept { - if (!m_buff.empty()) { - m_buff[0] = 0; - } else { - m_buff.push_back(0); - } -} +constexpr BasicString::BasicString() noexcept = default; template -constexpr BasicString::BasicString(std::size_t cap) noexcept: m_buff(cap + 1) { - // GCC complains if you don't do this pretty unnecessary size check - if (!m_buff.empty()) { - m_buff[0] = 0; - } -} +constexpr BasicString::BasicString(std::size_t cap) noexcept: m_buff(cap + 1) {} template constexpr BasicString::BasicString(const char *str) noexcept { @@ -313,6 +302,7 @@ constexpr BasicString::BasicString(const BasicString &other) template constexpr BasicString::BasicString(BasicString &&other) noexcept: m_buff(std::move(other.m_buff)) { + other.m_buff.push_back(0); } template @@ -358,6 +348,7 @@ template constexpr BasicString &BasicString::operator=(BasicString &&src) noexcept { if (this != &src) { m_buff = std::move(src.m_buff); + src.m_buff.push_back(0); } return *this; }