added exclude alias for type_list

This commit is contained in:
Michele Caini
2018-12-21 16:22:52 +01:00
parent cbb1131a5d
commit ebb2974ca7
4 changed files with 10 additions and 3 deletions

1
TODO
View File

@@ -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

View File

@@ -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

View File

@@ -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...>;
}

View File

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