doc: updated documentation for registry remove/erase

This commit is contained in:
Michele Caini
2020-10-28 13:03:15 +01:00
parent 2820f2658b
commit 5e1d77fcd5
2 changed files with 8 additions and 2 deletions

1
TODO
View File

@@ -17,6 +17,7 @@
- ...
WIP:
* remove extended registry::remove, rename it to (basic) erase and document the handle way for extended operations
* make view pack work also with groups
* add exclude-only views to combine with packs
* deprecate non-owning groups in favor of owning views and view packs, introduce lazy owning views

View File

@@ -292,11 +292,16 @@ bool all = registry.has<position, velocity>(entity);
bool any = registry.any<position, velocity>(entity);
```
If the goal is to delete a single component from an entity that owns it, the
`remove` member function template is the way to go:
If the goal is to delete a single component from an entity that owns it or even
multiple instances of a given type at once, the `remove` and `erase` member
function templates are the way to go:
```cpp
// removes the component from its entity
registry.remove<position>(entity);
// removes multiple instances of the given type at once
registry.remove<position>(std::cbegin(entities), std::cend(entities));
```
When in doubt whether the entity owns the component, use the `remove_if_exists`