[ox/std] Add char8_t* constructor to String

This commit is contained in:
Gary Talent 2021-11-08 02:25:20 -06:00
parent 15947d2fa9
commit 46fe5c3b8f

View File

@ -32,6 +32,8 @@ class BasicString {
constexpr BasicString(const char *str) noexcept;
constexpr BasicString(const char8_t *str) noexcept;
constexpr BasicString(const char *str, std::size_t size) noexcept;
constexpr BasicString(const BasicString&) noexcept;
@ -221,6 +223,16 @@ constexpr BasicString<SmallStringSize>::BasicString(const char *str) noexcept {
*this = str;
}
template<std::size_t SmallStringSize>
constexpr BasicString<SmallStringSize>::BasicString(const char8_t *str) noexcept {
if (m_buff.size()) {
m_buff[0] = 0;
} else {
m_buff.push_back(0);
}
*this = str;
}
template<std::size_t SmallStringSize>
constexpr BasicString<SmallStringSize>::BasicString(const char *str, std::size_t size) noexcept {
m_buff.resize(size + 1);