resource: add member function handle
This commit is contained in:
@@ -157,6 +157,14 @@ public:
|
||||
return value.use_count();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the underlying resource handle.
|
||||
* @return The underlying resource handle.
|
||||
*/
|
||||
[[nodiscard]] handle_type handle() const noexcept {
|
||||
return value;
|
||||
}
|
||||
|
||||
private:
|
||||
handle_type value;
|
||||
};
|
||||
|
||||
@@ -30,7 +30,7 @@ TEST(Resource, Functionalities) {
|
||||
|
||||
ASSERT_FALSE(resource);
|
||||
ASSERT_EQ(resource.operator->(), nullptr);
|
||||
ASSERT_EQ(resource.use_count(), 0l);
|
||||
ASSERT_EQ(resource.handle().use_count(), 0l);
|
||||
|
||||
const auto value = std::make_shared<derived>();
|
||||
entt::resource<derived> other{value};
|
||||
|
||||
Reference in New Issue
Block a user