Make StringViewLiteral use ConstEval
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Deukhoofd 2020-07-10 11:07:34 +02:00
parent 0d2bec95e8
commit 84052a2d94
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
1 changed files with 4 additions and 4 deletions

View File

@ -11,9 +11,9 @@ namespace ArbUt {
const char* _str; const char* _str;
public: public:
constexpr StringViewLiteral(const char* str, size_t size) noexcept consteval StringViewLiteral(const char* str, size_t size) noexcept
: BasicStringView(size, Hash(str)), _str(str) {} : BasicStringView(size, Hash(str)), _str(str) {}
constexpr StringViewLiteral(const char* str) noexcept : StringViewLiteral(str, CalcLength(str)){}; consteval StringViewLiteral(const char* str) noexcept : StringViewLiteral(str, CalcLength(str)){};
[[nodiscard]] inline constexpr const char* c_str() const noexcept { return _str; } [[nodiscard]] inline constexpr const char* c_str() const noexcept { return _str; }
constexpr std::string_view std_str() const noexcept { return std::string_view(_str, _length); } constexpr std::string_view std_str() const noexcept { return std::string_view(_str, _length); }
constexpr std::size_t operator()(StringViewLiteral const& s) const noexcept { return s.GetHash(); } constexpr std::size_t operator()(StringViewLiteral const& s) const noexcept { return s.GetHash(); }
@ -36,10 +36,10 @@ namespace std {
}; };
} }
inline constexpr ArbUt::StringViewLiteral operator"" _const_nocase(const char* c, size_t l) { inline consteval ArbUt::StringViewLiteral operator"" _const_nocase(const char* c, size_t l) {
return ArbUt::StringViewLiteral(c, l); return ArbUt::StringViewLiteral(c, l);
} }
inline constexpr ArbUt::StringViewLiteral operator"" _cnc(const char* c, size_t l) { inline consteval ArbUt::StringViewLiteral operator"" _cnc(const char* c, size_t l) {
return ArbUt::StringViewLiteral(c, l); return ArbUt::StringViewLiteral(c, l);
} }