added exclude alias for type_list
This commit is contained in:
1
TODO
1
TODO
@@ -20,5 +20,4 @@
|
||||
* mention hunter in the readme file, section packaging tools
|
||||
* travis + windows is now available, try it
|
||||
* events on replace, so that one can track updated components? indagate impact
|
||||
* add entt::exclude as alias of entt::type_list
|
||||
* add sparse_set::swap and registry::swap
|
||||
|
||||
@@ -1037,7 +1037,7 @@ auto view = registry.persistent_view<position, velocity>();
|
||||
Filtering entities by components is also supported:
|
||||
|
||||
```cpp
|
||||
auto view = registry.persistent_view<position, velocity>(entt::type_list<renderable>);
|
||||
auto view = registry.persistent_view<position, velocity>(entt::exclude<renderable>);
|
||||
```
|
||||
|
||||
In this case, the view will return all the entities that have both components
|
||||
|
||||
@@ -34,6 +34,14 @@ constexpr auto type_list_cat(type_list<Type...>, type_list<Other...>, List...) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Alias template for type lists.
|
||||
* @tparam Type List of types.
|
||||
*/
|
||||
template<typename... Type>
|
||||
using exclude = type_list<Type...>;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -279,7 +279,7 @@ TEST(PersistentView, ExcludedComponents) {
|
||||
registry.assign<int>(e1, 1);
|
||||
registry.assign<char>(e1);
|
||||
|
||||
const auto view = registry.persistent_view<int>(entt::type_list<char>{});
|
||||
const auto view = registry.persistent_view<int>(entt::exclude<char>{});
|
||||
|
||||
const auto e2 = registry.create();
|
||||
registry.assign<int>(e2, 2);
|
||||
|
||||
Reference in New Issue
Block a user