소스 검색

doc: updated documentation for registry remove/erase

Michele Caini 5 년 전
부모
커밋
5e1d77fcd5
2개의 변경된 파일8개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 0
      TODO
  2. 7 2
      docs/md/entity.md

+ 1 - 0
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

+ 7 - 2
docs/md/entity.md

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