[ox/std] Add char8_t* constructor to String
This commit is contained in:
parent
15947d2fa9
commit
46fe5c3b8f
12
deps/ox/src/ox/std/string.hpp
vendored
12
deps/ox/src/ox/std/string.hpp
vendored
@ -32,6 +32,8 @@ class BasicString {
|
|||||||
|
|
||||||
constexpr BasicString(const char *str) noexcept;
|
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 char *str, std::size_t size) noexcept;
|
||||||
|
|
||||||
constexpr BasicString(const BasicString&) noexcept;
|
constexpr BasicString(const BasicString&) noexcept;
|
||||||
@ -221,6 +223,16 @@ constexpr BasicString<SmallStringSize>::BasicString(const char *str) noexcept {
|
|||||||
*this = str;
|
*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>
|
template<std::size_t SmallStringSize>
|
||||||
constexpr BasicString<SmallStringSize>::BasicString(const char *str, std::size_t size) noexcept {
|
constexpr BasicString<SmallStringSize>::BasicString(const char *str, std::size_t size) noexcept {
|
||||||
m_buff.resize(size + 1);
|
m_buff.resize(size + 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user