DarkSharpness commented on code in PR #286:
URL: https://github.com/apache/tvm-ffi/pull/286#discussion_r2577961053
##########
include/tvm/ffi/reflection/registry.h:
##########
@@ -270,52 +274,49 @@ class ReflectionDefBase {
}
}
+ template <typename Func>
+ TVM_FFI_INLINE static Function GetMethod(std::string name, Func&& func) {
+ return ffi::Function::FromTyped(WrapFunction(std::forward<Func>(func)),
std::move(name));
+ }
+
+ template <typename Func>
+ TVM_FFI_INLINE static Func&& WrapFunction(Func&& func) {
+ return std::forward<Func>(func);
+ }
template <typename Class, typename R, typename... Args>
- TVM_FFI_INLINE static Function GetMethod(std::string name, R
(Class::*func)(Args...)) {
+ TVM_FFI_INLINE static auto WrapFunction(R (Class::*func)(Args...)) {
Review Comment:
The return type here is a lambda function (so we can only return by `auto`).
We just do some generalization here for code reuse in `OverloadObjectDef`.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]