[core] Keep StringRef::str() inline

The std::string range constructor reads nothing for a zero length, so the guard only
pushed str() out of line; the memcmp guards stay.
This commit is contained in:
J. Nick Koston
2026-09-08 03:22:05 +02:00
parent 63b5331e47
commit a7bf937001
+1 -1
View File
@@ -96,7 +96,7 @@ class StringRef {
return actual;
}
std::string str() const { return len_ == 0 ? std::string() : std::string(base_, len_); }
std::string str() const { return std::string(base_, len_); } // fine for {nullptr, 0}: nothing is read
const uint8_t *byte() const { return reinterpret_cast<const uint8_t *>(base_); }
operator std::string() const { return str(); }