guan404ming commented on code in PR #399:
URL: https://github.com/apache/tvm-ffi/pull/399#discussion_r2723612542


##########
include/tvm/ffi/function_details.h:
##########
@@ -67,10 +72,23 @@ static constexpr bool ArgSupported =
       std::is_same_v<std::remove_const_t<std::remove_reference_t<T>>, AnyView> 
||
       TypeTraitsNoCR<T>::convert_enabled));
 
+template <typename T>
+struct is_expected : std::false_type {
+  using value_type = void;
+};
+
+template <typename T>
+struct is_expected<Expected<T>> : std::true_type {
+  using value_type = T;
+};
+
+template <typename T>
+inline constexpr bool is_expected_v = is_expected<T>::value;
+
 // NOTE: return type can only support non-reference managed returns
 template <typename T>
-static constexpr bool RetSupported =
-    (std::is_same_v<T, Any> || std::is_void_v<T> || 
TypeTraits<T>::convert_enabled);
+static constexpr bool RetSupported = (std::is_same_v<T, Any> || 
std::is_void_v<T> ||
+                                      TypeTraits<T>::convert_enabled || 
is_expected_v<T>);

Review Comment:
   You right, let me remove it.



##########
include/tvm/ffi/function_details.h:
##########
@@ -67,10 +72,23 @@ static constexpr bool ArgSupported =
       std::is_same_v<std::remove_const_t<std::remove_reference_t<T>>, AnyView> 
||
       TypeTraitsNoCR<T>::convert_enabled));
 
+template <typename T>
+struct is_expected : std::false_type {
+  using value_type = void;
+};
+
+template <typename T>
+struct is_expected<Expected<T>> : std::true_type {
+  using value_type = T;
+};
+
+template <typename T>
+inline constexpr bool is_expected_v = is_expected<T>::value;
+
 // NOTE: return type can only support non-reference managed returns
 template <typename T>
-static constexpr bool RetSupported =
-    (std::is_same_v<T, Any> || std::is_void_v<T> || 
TypeTraits<T>::convert_enabled);
+static constexpr bool RetSupported = (std::is_same_v<T, Any> || 
std::is_void_v<T> ||
+                                      TypeTraits<T>::convert_enabled || 
is_expected_v<T>);

Review Comment:
   You're right, let me remove it.



-- 
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]

Reply via email to