tqchen commented on a change in pull request #4628: [Object] Add String
container
URL: https://github.com/apache/incubator-tvm/pull/4628#discussion_r376752387
##########
File path: include/tvm/runtime/container.h
##########
@@ -457,6 +470,26 @@ class String : public ObjectRef {
*/
operator std::string() const { return std::string{get()->data, size()}; }
+#if TVM_USE_CXX17_STRING_VIEW
+ /*!
+ * \brief Convert String to an std::string_view object
+ *
+ * \return std::string_view
+ */
+ operator std::string_view() const {
+ return std::string_view{get()->data, size()};
+ }
+#elif TVM_USE_CXX14_STRING_VIEW
+ /*!
+ * \brief Convert String to an std::experimental::string_view object
+ *
+ * \return std::experimental::string_view
+ */
+ operator std::experimental::string_view() const {
+ return std::experimental::string_view{get()->data, size()};
Review comment:
I am not to sure if we want to convert to experimental string_view, as it is
not a part of std yet
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services