diff --git a/src/template.h b/src/template.h index 1a48d787..3061ad52 100644 --- a/src/template.h +++ b/src/template.h @@ -387,19 +387,19 @@ public: using const_pointer = const value_type *; using const_iterator = const_pointer; - StringRef() : base(""), len(0) {} + constexpr StringRef() : base(""), len(0) {} explicit StringRef(const std::string &s) : base(s.c_str()), len(s.size()) {} explicit StringRef(const ImmutableString &s) : base(s.c_str()), len(s.size()) {} StringRef(const char *s) : base(s), len(strlen(s)) {} template - StringRef(const CharT *s, size_t n) + constexpr StringRef(const CharT *s, size_t n) : base(reinterpret_cast(s)), len(n) {} template StringRef(InputIt first, InputIt last) : base(first), len(std::distance(first, last)) {} template - static StringRef from_lit(const CharT(&s)[N]) { + constexpr static StringRef from_lit(const CharT(&s)[N]) { return StringRef(s, N - 1); } static StringRef from_maybe_nullptr(const char *s) {