diff --git a/deps/ox/src/ox/std/stringliteral.hpp b/deps/ox/src/ox/std/stringliteral.hpp index 986e8b9d..ec5d4631 100644 --- a/deps/ox/src/ox/std/stringliteral.hpp +++ b/deps/ox/src/ox/std/stringliteral.hpp @@ -16,24 +16,19 @@ namespace ox { * StringLiteral is used for functions that want to ensure that they are taking * string literals, and not strings outside of the data section of the program * that might get deleted. - * This type cannot force you to use it correctly, so don't give it something - * that is not a literal. - * If you do this: - * StringLiteral(str.c_str()) - * the resulting segfault is on you. */ class StringLiteral: public detail::BaseStringView { public: - constexpr StringLiteral() noexcept = default; + consteval StringLiteral() noexcept = default; constexpr StringLiteral(StringLiteral const &sv) noexcept = default; - constexpr explicit StringLiteral(std::nullptr_t) noexcept {} + consteval explicit StringLiteral(std::nullptr_t) noexcept {} - constexpr explicit StringLiteral(const char *str, std::size_t len) noexcept: BaseStringView{str, len} {} + consteval explicit StringLiteral(char const *str, std::size_t const len) noexcept: BaseStringView{str, len} {} OX_ALLOW_UNSAFE_BUFFERS_BEGIN - constexpr explicit StringLiteral(char const *str) noexcept: StringLiteral{str, ox::strlen(str)} {} + consteval explicit StringLiteral(char const *str) noexcept: StringLiteral{str, ox::strlen(str)} {} OX_ALLOW_UNSAFE_BUFFERS_END constexpr StringLiteral &operator=(StringLiteral const &other) noexcept { @@ -42,7 +37,7 @@ class StringLiteral: public detail::BaseStringView { } [[nodiscard]] - constexpr const char *c_str() const noexcept { + constexpr char const *c_str() const noexcept { return data(); }