junrushao1994 commented on a change in pull request #9748:
URL: https://github.com/apache/tvm/pull/9748#discussion_r807654206
##########
File path: include/tvm/runtime/container/optional.h
##########
@@ -93,6 +93,11 @@ class Optional : public ObjectRef {
ICHECK(data_ != nullptr);
return T(data_);
}
+ /*!
+ * \return The internal object pointer with container type of T.
+ * \note This function do not perform not-null checking.
+ */
+ const ContainerType* get() const { return
static_cast<ContainerType*>(data_.get()); }
Review comment:
Thanks @tqchen for the valuable feedback! On the other hand, I would say
this PR actually does is to simply improve the `Optional::get` method to return
the underlying type instead of the plain Object pointer, and hence it might
make sense to keep the name as it is. What do you think>?
##########
File path: include/tvm/runtime/container/optional.h
##########
@@ -93,6 +93,11 @@ class Optional : public ObjectRef {
ICHECK(data_ != nullptr);
return T(data_);
}
+ /*!
+ * \return The internal object pointer with container type of T.
+ * \note This function do not perform not-null checking.
+ */
+ const ContainerType* get() const { return
static_cast<ContainerType*>(data_.get()); }
Review comment:
Thanks @tqchen for the valuable feedback! On the other hand, I would say
this PR actually does is to simply improve the `Optional::get` method to return
the underlying type instead of the plain Object pointer, and hence it might
make sense to keep the name as it is. What do you think?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]