[ox/std] Add operator std::string and operator const char* to String
This commit is contained in:
parent
addc2233e7
commit
779b18e410
13
deps/ox/src/ox/std/string.hpp
vendored
13
deps/ox/src/ox/std/string.hpp
vendored
@ -193,11 +193,21 @@ class BasicString {
|
|||||||
return static_cast<const char*>(m_buff.data());
|
return static_cast<const char*>(m_buff.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
|
inline explicit operator const char*() const {
|
||||||
|
return c_str();
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef OX_USE_STDLIB
|
#ifdef OX_USE_STDLIB
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
inline std::string toStdString() const {
|
inline std::string toStdString() const {
|
||||||
return c_str();
|
return c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]]
|
||||||
|
inline explicit operator std::string() const {
|
||||||
|
return c_str();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -271,8 +281,7 @@ constexpr BasicString<SmallStringSize>::BasicString(const BasicString &other) no
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t SmallStringSize>
|
template<std::size_t SmallStringSize>
|
||||||
constexpr BasicString<SmallStringSize>::BasicString(BasicString &&other) noexcept {
|
constexpr BasicString<SmallStringSize>::BasicString(BasicString &&other) noexcept: m_buff(std::move(other.m_buff)) {
|
||||||
m_buff = std::move(other.m_buff);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<std::size_t SmallStringSize>
|
template<std::size_t SmallStringSize>
|
||||||
|
Loading…
Reference in New Issue
Block a user