Fix call of JObjectArrayElement

This commit is contained in:
LoveSy 2023-12-06 21:26:24 +08:00
parent 0f0f9f7bcd
commit a1948df0dc

View File

@ -82,6 +82,8 @@ private:
DISALLOW_COPY_AND_ASSIGN(ScopedLocalRef);
};
class JObjectArrayElement;
template <typename T>
concept JArray = std::is_base_of_v<std::remove_pointer_t<_jarray>, std::remove_pointer_t<T>>;
@ -114,7 +116,9 @@ public:
template <typename T, typename U>
concept ScopeOrRaw = std::is_convertible_v<T, U> ||
(is_instance_v<std::decay_t<T>, ScopedLocalRef>
&&std::is_convertible_v<typename std::decay_t<T>::BaseType, U>);
&&std::is_convertible_v<typename std::decay_t<T>::BaseType, U>) ||
(std::is_same_v<std::decay_t<T>, JObjectArrayElement>
&&std::is_convertible_v<jobject, U>);
template <typename T>
concept ScopeOrClass = ScopeOrRaw<T, jclass>;
@ -141,6 +145,8 @@ template <typename T>
return x.data();
else if constexpr (is_instance_v<std::decay_t<T>, ScopedLocalRef>)
return x.get();
else if constexpr (std::is_same_v<std::decay_t<T>, JObjectArrayElement>)
return x.get();
else
return std::forward<T>(x);
}
@ -1013,8 +1019,7 @@ private:
DISALLOW_COPY_AND_ASSIGN(ScopedLocalRef);
};
class JObjectArrayElement{
class JObjectArrayElement {
friend class ScopedLocalRef<jobjectArray>;
auto obtain() {