tqchen commented on a change in pull request #4628: [Object] Add String 
container
URL: https://github.com/apache/incubator-tvm/pull/4628#discussion_r374450428
 
 

 ##########
 File path: include/tvm/runtime/container.h
 ##########
 @@ -274,7 +276,181 @@ class ADT : public ObjectRef {
   TVM_DEFINE_OBJECT_REF_METHODS(ADT, ObjectRef, ADTObj);
 };
 
+/*! \brief An object representing string. It's POD type. */
+class StringObj : public Object {
+ public:
+  /*! \brief The length of the string object. */
+  uint32_t size;
+
+  /*! \brief The pointer to string data. */
+  const char* data;
+
+  static constexpr const uint32_t _type_index = TypeIndex::kDynamic;
+  static constexpr const char* _type_key = "String";
+  TVM_DECLARE_FINAL_OBJECT_INFO(StringObj, Object);
+
+ private:
+  /*! \brief String object which is moved from std::string container. */
+  class FromStd;
+
+  friend class String;
+};
+
+/*! \brief reference to string objects. */
+class String : public ObjectRef {
+ public:
+  /*!
+   * \brief Construct a new String object
+   *
+   * \param other The moved/copied std::string object
+   *
+   * \note If user passes const reference, it will trigger copy. If it's 
rvalue,
+   * it will be moved into other.
+   */
+  inline explicit String(std::string other);
+
 
 Review comment:
   Need also to overload operator=(std::string other)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to