diff --git a/src/template.h b/src/template.h index b15efa02..1664714a 100644 --- a/src/template.h +++ b/src/template.h @@ -401,8 +401,9 @@ public: explicit StringRef(const ImmutableString &s) : base(s.c_str()), len(s.size()) {} explicit StringRef(const char *s) : base(s), len(strlen(s)) {} + constexpr StringRef(const char *s, size_t n) : base(s), len(n) {} template - constexpr StringRef(const CharT *s, size_t n) + StringRef(const CharT *s, size_t n) : base(reinterpret_cast(s)), len(n) {} template StringRef(InputIt first, InputIt last) @@ -413,7 +414,7 @@ public: len(std::distance(first, last)) {} template constexpr static StringRef from_lit(const CharT(&s)[N]) { - return StringRef(s, N - 1); + return StringRef{s, N - 1}; } static StringRef from_maybe_nullptr(const char *s) { if (s == nullptr) {