junrushao commented on code in PR #666:
URL: https://github.com/apache/tvm-ffi/pull/666#discussion_r3583241773
##########
include/tvm/ffi/container/variant.h:
##########
@@ -83,6 +91,16 @@ class Variant {
*/
Variant& operator=(Variant<V...>&& other) noexcept = default;
+ template <typename... U, std::enable_if_t<(variant_contains_v<U> && ...),
int> = 0>
+ TVM_FFI_INLINE Variant& operator=(const Variant<U...>& other) {
+ return operator=(Variant(other));
+ }
+
+ template <typename... U, std::enable_if_t<(variant_contains_v<U> && ...),
int> = 0>
+ TVM_FFI_INLINE Variant& operator=(Variant<U...>&& other) {
+ return operator=(Variant(std::move(other)));
+ }
Review Comment:
Fixed in `bef03d5`. Both converting assignment operators now require
`!std::is_same_v<Variant, Variant<U...>>`, keeping exact-type copy and move on
the default assignment operators and avoiding recursive template assignment.
The full C++ test suite and targeted clang-tidy pass.
--
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]