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
60
60
: obj(&o)
61
61
{}
62
62
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
+
63
68
explicit operator bool () const { return obj; }
64
69
65
70
operator UntaggedObjectType*() const { return obj; }
Original file line number Diff line number Diff line change @@ -21,6 +21,9 @@ namespace
21
21
void Void (jni::JNIEnv&, jni::jboolean b) { assert (b == jni::jni_true); }
22
22
static void Static (jni::JNIEnv&, Peer&) {}
23
23
};
24
+
25
+ struct Base {};
26
+ struct Derived : public Base {};
24
27
}
25
28
26
29
int main ()
@@ -120,6 +123,10 @@ int main()
120
123
string.NewWeakGlobalRef (env);
121
124
string.NewLocalRef (env);
122
125
126
+ jni::Object<Derived> derived;
127
+ jni::Object<Base> base (derived);
128
+ base = derived;
129
+ (void )[] () -> jni::Object<Base> { return jni::Object<Derived>(); };
123
130
124
131
// / Constructor
125
132
You can’t perform that action at this time.
0 commit comments