From 08029f597bfd6c206e75dd2d67f3521421b54408 Mon Sep 17 00:00:00 2001 From: Zhi Chen Date: Mon, 15 Jun 2020 21:59:44 +0000 Subject: [PATCH] use FromStd --- include/tvm/runtime/container.h | 31 ++----------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) 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_);