File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,11 @@ namespace jni
6060 : obj(&o)
6161 {}
6262
63+ template < class Tag >
64+ Object (const Object<Tag>& o, std::enable_if_t < std::is_convertible<Tag, TagType>::value >* = 0 )
65+ : obj(o.Get())
66+ {}
67+
6368 explicit operator bool () const { return obj; }
6469
6570 operator UntaggedObjectType*() const { return obj; }
Original file line number Diff line number Diff line change @@ -21,6 +21,9 @@ namespace
2121 void Void (jni::JNIEnv&, jni::jboolean b) { assert (b == jni::jni_true); }
2222 static void Static (jni::JNIEnv&, Peer&) {}
2323 };
24+
25+ struct Base {};
26+ struct Derived : public Base {};
2427 }
2528
2629int main ()
@@ -120,6 +123,10 @@ int main()
120123 string.NewWeakGlobalRef (env);
121124 string.NewLocalRef (env);
122125
126+ jni::Object<Derived> derived;
127+ jni::Object<Base> base (derived);
128+ base = derived;
129+ (void )[] () -> jni::Object<Base> { return jni::Object<Derived>(); };
123130
124131 // / Constructor
125132
You can’t perform that action at this time.
0 commit comments