Class ChildIterator¶
Defined in File entity_iterators.h
Class Documentation¶
-
class ChildIterator¶
Forward iterator for traversing direct children of an entity.
ChildIterator provides STL-compliant forward iteration over an entity’s immediate children by following the sibling linked list in RelationshipComponent. This is a non-recursive iteration - it only visits direct children, not descendants.
The iterator wraps raw entt::entity IDs in Portal’s Entity class for convenient access.
See also
ChildRange for the range wrapper
See also
RecursiveChildIterator for recursive traversal
See also
RelationshipComponent for the underlying linked list structure
- Example:
for (auto child : entity.children()) { // Only processes direct children child.get_component<TransformComponent>(); }
Public Types
-
using iterator_category = std::forward_iterator_tag¶
-
using difference_type = std::ptrdiff_t¶
-
using pointer = value_type*¶
-
using reference = value_type&¶
Public Functions
-
ChildIterator(entt::entity current, entt::registry *registry)¶
Constructs an iterator at the specified child entity.
- Parameters:
current – The current child entity ID
registry – Pointer to the registry containing the entity
-
Entity operator*() const¶
Dereferences the iterator to access the current child entity.
- Returns:
The current child as an Entity wrapper
-
Entity operator->() const¶
Arrow operator for accessing the current child entity.
- Returns:
The current child as an Entity wrapper
-
ChildIterator &operator++()¶
Advances to the next sibling.
- Returns:
Reference to this iterator
-
ChildIterator operator++(int)¶
Post-increment (advances to next sibling).
- Returns:
Copy of the iterator before advancement
-
bool operator==(const ChildIterator &other) const¶
Compares iterators for equality.
- Parameters:
other – The iterator to compare against
- Returns:
true if both iterators point to the same entity
-
bool operator!=(const ChildIterator &other) const¶
Compares iterators for inequality.
- Parameters:
other – The iterator to compare against
- Returns:
true if iterators point to different entities