multi-component registry::shrink_to_fit
This commit is contained in:
@@ -425,12 +425,13 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Requests the removal of unused capacity for a given component.
|
||||
* @tparam Component Type of component for which to reclaim unused capacity.
|
||||
* @brief Requests the removal of unused capacity for the given components.
|
||||
* @tparam Component Types of components for which to reclaim unused
|
||||
* capacity.
|
||||
*/
|
||||
template<typename Component>
|
||||
template<typename... Component>
|
||||
void shrink_to_fit() {
|
||||
assure<Component>()->shrink_to_fit();
|
||||
(assure<Component>()->shrink_to_fit(), ...);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -245,8 +245,7 @@ TEST(Registry, Functionalities) {
|
||||
ASSERT_EQ(registry.capacity<int>(), entt::registry::size_type{8});
|
||||
ASSERT_EQ(registry.capacity<char>(), entt::registry::size_type{8});
|
||||
|
||||
registry.shrink_to_fit<int>();
|
||||
registry.shrink_to_fit<char>();
|
||||
registry.shrink_to_fit<int, char>();
|
||||
|
||||
ASSERT_EQ(registry.capacity<int>(), entt::registry::size_type{});
|
||||
ASSERT_EQ(registry.capacity<char>(), entt::registry::size_type{});
|
||||
|
||||
Reference in New Issue
Block a user