handle: better API
This commit is contained in:
@@ -46,6 +46,14 @@ struct basic_handle {
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Assigns the null object to a handle.
|
||||
* @return This handle.
|
||||
*/
|
||||
basic_handle & operator=(null_t) ENTT_NOEXCEPT {
|
||||
return (*this = static_cast<entity_type>(null));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Constructs a const handle from a non-const one.
|
||||
* @return A const handle referring to the same entity.
|
||||
|
||||
@@ -39,7 +39,7 @@ TEST(BasicHandle, Construction) {
|
||||
static_assert(std::is_same_v<entt::registry &, decltype(handle.registry())>);
|
||||
static_assert(std::is_same_v<const entt::registry &, decltype(chandle.registry())>);
|
||||
|
||||
handle = static_cast<entt::entity>(entt::null);
|
||||
handle = entt::null;
|
||||
|
||||
ASSERT_TRUE(entt::null == handle.entity());
|
||||
ASSERT_NE(entity, handle);
|
||||
|
||||
Reference in New Issue
Block a user