multi-component registry::shrink_to_fit

This commit is contained in:
Michele Caini
2019-09-11 23:12:14 +02:00
parent d4b18b1e27
commit ee373eb6fb
2 changed files with 6 additions and 6 deletions

View File

@@ -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(), ...);
}
/**

View File

@@ -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{});