navicat-keygen-2023/common/resource_traits/cxx_object_traits.hpp
Double Sine 9017721a5c
upload codebase
Signed-off-by: Double Sine <xiao_ai_yu@live.cn>
2022-02-14 15:52:37 +08:00

22 lines
450 B
C++

#pragma once
namespace nkg::resource_traits {
template<typename object_t>
struct cxx_object_traits {
using handle_t = object_t*;
static constexpr handle_t invalid_value = nullptr;
[[nodiscard]]
static bool is_valid(const handle_t& handle) noexcept {
return handle != invalid_value;
}
static void release(const handle_t& handle) {
delete handle;
}
};
}