[ox/std] Add operator std::string and operator const char* to String

This commit is contained in:
Gary Talent 2022-05-28 03:19:50 -05:00
parent addc2233e7
commit 779b18e410

View File

@ -193,11 +193,21 @@ class BasicString {
return static_cast<const char*>(m_buff.data());
}
[[nodiscard]]
inline explicit operator const char*() const {
return c_str();
}
#ifdef OX_USE_STDLIB
[[nodiscard]]
inline std::string toStdString() const {
return c_str();
}
[[nodiscard]]
inline explicit operator std::string() const {
return c_str();
}
#endif
/**
@ -271,8 +281,7 @@ constexpr BasicString<SmallStringSize>::BasicString(const BasicString &other) no
}
template<std::size_t SmallStringSize>
constexpr BasicString<SmallStringSize>::BasicString(BasicString &&other) noexcept {
m_buff = std::move(other.m_buff);
constexpr BasicString<SmallStringSize>::BasicString(BasicString &&other) noexcept: m_buff(std::move(other.m_buff)) {
}
template<std::size_t SmallStringSize>