doc: updated documentation for registry remove/erase
This commit is contained in:
1
TODO
1
TODO
@@ -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
|
||||
|
||||
@@ -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`
|
||||
|
||||
Reference in New Issue
Block a user