Commit 3cbadf42 authored by Max Kellermann's avatar Max Kellermann

java/Ref: add move constructor

parent 1d49f110
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
#include <jni.h> #include <jni.h>
#include <utility>
#include <assert.h> #include <assert.h>
namespace Java { namespace Java {
...@@ -56,6 +58,10 @@ namespace Java { ...@@ -56,6 +58,10 @@ namespace Java {
assert(env != nullptr); assert(env != nullptr);
} }
LocalRef(LocalRef &&src) noexcept
:env(src.env),
value(std::exchange(src.value, nullptr)) {}
~LocalRef() noexcept { ~LocalRef() noexcept {
env->DeleteLocalRef(value); env->DeleteLocalRef(value);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment