java/Ref: add move operator

This commit is contained in:
Max Kellermann 2021-03-28 13:09:13 +02:00 committed by Max Kellermann
parent 16d187b7ed
commit a52ce7bb7b

View File

@ -68,8 +68,12 @@ namespace Java {
env->DeleteLocalRef(value);
}
LocalRef(const LocalRef &other) = delete;
LocalRef &operator=(const LocalRef &other) = delete;
LocalRef &operator=(LocalRef &&src) noexcept {
using std::swap;
swap(env, src.env);
swap(value, src.value);
return *this;
}
JNIEnv *GetEnv() const noexcept {
return env;