added empty<Comp> to the registry

This commit is contained in:
Michele Caini
2017-03-31 23:20:31 +02:00
parent a318ac80e9
commit 129b3f1830
2 changed files with 11 additions and 0 deletions

View File

@@ -256,6 +256,11 @@ public:
return available.size() == count;
}
template<typename Comp>
bool empty() const noexcept {
return pool.template empty<Comp>();
}
entity_type create() noexcept {
entity_type entity;

View File

@@ -10,9 +10,15 @@ TEST(DefaultRegistry, Functionalities) {
ASSERT_EQ(registry.capacity(), registry_type::size_type{0});
ASSERT_TRUE(registry.empty());
ASSERT_TRUE(registry.empty<int>());
ASSERT_TRUE(registry.empty<char>());
registry_type::entity_type e1 = registry.create();
registry_type::entity_type e2 = registry.create<int, char>();
ASSERT_FALSE(registry.empty<int>());
ASSERT_FALSE(registry.empty<char>());
ASSERT_NE(e1, e2);
ASSERT_FALSE(registry.has<int>(e1));