Reworking dependencies

This commit is contained in:
Zoe Roux
2021-05-21 16:51:18 +02:00
parent dee56a52c7
commit e5d3823d0c
12 changed files with 53 additions and 35 deletions

View File

@@ -59,4 +59,12 @@ namespace WAL
});
return existing != this->_components.end();
}
bool Entity::hasComponent(const std::type_index &type) const
{
auto existing = std::find_if(this->_components.begin(), this->_components.end(), [&type] (const auto &cmp) {
return std::type_index(typeid(*cmp)) == type;
});
return existing != this->_components.end();
}
}