/* * Copyright (c) 2015-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #pragma once #include #include #include #include namespace facebook { namespace jni { template struct LocalReferenceDeleter { static_assert(std::is_convertible::value, "LocalReferenceDeleter instantiated with type that is not convertible to jobject"); void operator()(T localReference) { if (localReference != nullptr) { Environment::current()->DeleteLocalRef(localReference); } } }; template using LocalReference = std::unique_ptr::type, LocalReferenceDeleter>; } }