diff options
Diffstat (limited to 'src/mongo/base/string_data.h')
-rw-r--r-- | src/mongo/base/string_data.h | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/src/mongo/base/string_data.h b/src/mongo/base/string_data.h index bc2ee4ffc36..eb762771a77 100644 --- a/src/mongo/base/string_data.h +++ b/src/mongo/base/string_data.h @@ -90,12 +90,6 @@ public: StringData(const std::string& s) : StringData(s.data(), s.length(), TrustedInitTag()) {} /** - * Implicitly convert a std::string_view to a StringData. We can use the trusted - * init path because string_view::data() points to length() bytes of data. - */ - StringData(std::string_view s) : StringData(s.data(), s.length(), TrustedInitTag()) {} - - /** * Constructs a StringData with an explicit length. 'c' must * either be nullptr (in which case len must be zero), or be a * pointer into a character array. The StringData will refer to @@ -112,18 +106,6 @@ public: } /** - * Implicitly convert to a std::string_view. - */ - operator std::string_view() const { - // std::string_view produces undefined behaviour if [pointer, pointer + size) is not a valid - // range. To fix this we explicitly use default constructor if StringData contains nullptr. - if (MONGO_unlikely(rawData() == nullptr)) { - return {}; - } - return {rawData(), size()}; - } - - /** * Constructs a StringData with begin and end iterators. begin points to the beginning of the * string. end points to the position past the end of the string. In a null-terminated string, * end points to the null-terminator. |