From a52ce7bb7b0b2bdbba176f697dda8f36455aaa97 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 28 Mar 2021 13:09:13 +0200 Subject: [PATCH] java/Ref: add move operator --- src/java/Ref.hxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/java/Ref.hxx b/src/java/Ref.hxx index e19ebb930..297da92f0 100644 --- a/src/java/Ref.hxx +++ b/src/java/Ref.hxx @@ -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;