[ox/std] Fix StringLiteral::operator= to work with DevkitARM
This commit is contained in:
14
deps/ox/src/ox/std/stringliteral.hpp
vendored
14
deps/ox/src/ox/std/stringliteral.hpp
vendored
@ -20,26 +20,24 @@ namespace ox {
|
|||||||
* that is not a literal.
|
* that is not a literal.
|
||||||
* If you do this:
|
* If you do this:
|
||||||
* StringLiteral(str.c_str())
|
* StringLiteral(str.c_str())
|
||||||
* the resulting segfault is on you.
|
* the resulting segfault is on you.
|
||||||
*/
|
*/
|
||||||
class StringLiteral: public detail::BaseStringView {
|
class StringLiteral: public detail::BaseStringView {
|
||||||
public:
|
public:
|
||||||
constexpr StringLiteral() noexcept = default;
|
constexpr StringLiteral() noexcept = default;
|
||||||
|
|
||||||
constexpr StringLiteral(StringLiteral const&sv) noexcept = default;
|
constexpr StringLiteral(StringLiteral const &sv) noexcept = default;
|
||||||
|
|
||||||
constexpr explicit StringLiteral(std::nullptr_t) noexcept {}
|
constexpr explicit StringLiteral(std::nullptr_t) noexcept {}
|
||||||
|
|
||||||
constexpr explicit StringLiteral(const char *str, std::size_t len) noexcept: BaseStringView(str, len) {}
|
constexpr explicit StringLiteral(const char *str, std::size_t len) noexcept: BaseStringView{str, len} {}
|
||||||
|
|
||||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||||
constexpr explicit StringLiteral(char const *str) noexcept: StringLiteral(str, ox::strlen(str)) {}
|
constexpr explicit StringLiteral(char const *str) noexcept: StringLiteral{str, ox::strlen(str)} {}
|
||||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||||
|
|
||||||
constexpr StringLiteral &operator=(StringLiteral const&other) noexcept {
|
constexpr StringLiteral &operator=(StringLiteral const &other) noexcept {
|
||||||
if (&other != this) {
|
set(other.data(), other.len());
|
||||||
set(other.data(), other.len());
|
|
||||||
}
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user