java/Ref: add move constructor

This commit is contained in:
Max Kellermann 2019-04-11 11:34:52 +02:00
parent 1d49f1108f
commit 3cbadf42a5

View File

@ -34,6 +34,8 @@
#include <jni.h>
#include <utility>
#include <assert.h>
namespace Java {
@ -56,6 +58,10 @@ namespace Java {
assert(env != nullptr);
}
LocalRef(LocalRef &&src) noexcept
:env(src.env),
value(std::exchange(src.value, nullptr)) {}
~LocalRef() noexcept {
env->DeleteLocalRef(value);
}