java/Ref: add move constructor
This commit is contained in:
parent
1d49f1108f
commit
3cbadf42a5
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue