diff --git a/include/tvm/runtime/container.h b/include/tvm/runtime/container.h index 13b6b81de4cf..6ae6fec66e41 100644 --- a/include/tvm/runtime/container.h +++ b/include/tvm/runtime/container.h @@ -1106,8 +1106,6 @@ class StringObj : public Object { private: /*! \brief String object which is moved from std::string container. */ class FromStd; - /*! \brief String object that is constructed from char*. */ - class FromCharPtr; friend class String; }; @@ -1159,7 +1157,8 @@ class String : public ObjectRef { * * \param other a char array. */ - String(const char* other); // NOLINT(*); + String(const char* other) // NOLINT(*) + : String(std::string(other)) {} /*! * \brief Change the value the reference object points to. @@ -1355,23 +1354,6 @@ class StringObj::FromStd : public StringObj { friend class String; }; -/*! - * \brief The class that initializes and manages the memory of a String object - * created from char pointers. - */ -class StringObj::FromCharPtr : public StringObj, InplaceArrayBase { - public: - /*! \brief The size function needed by InplaceArrayBase */ - size_t GetSize() const { return size_; } - - private: - /*! \brief The length of the chars. */ - size_t size_; - - friend class String; - friend class InplaceArrayBase; -}; - inline String::String(std::string other) { auto ptr = make_object(std::move(other)); ptr->size = ptr->data_container.size(); @@ -1379,15 +1361,6 @@ inline String::String(std::string other) { data_ = std::move(ptr); } -inline String::String(const char* other) { - size_t size = std::strlen(other); - auto ptr = make_inplace_array_object(size); - ptr->size_ = size; - ptr->size = size; - ptr->data = other; - data_ = std::move(ptr); -} - inline String& String::operator=(std::string other) { String replace{std::move(other)}; data_.swap(replace.data_);