vecs
Fast, flexible ecs in C++ with ergonomic API
Loading...
Searching...
No Matches
vecs::Query< Components >::Iterator Class Reference

Iterator for iterating over entities matching the query. More...

#include <vecs.h>

Public Types

using iterator_category = std::forward_iterator_tag
 
using value_type
 
using difference_type = std::ptrdiff_t
 
using pointer
 
using reference = value_type
 

Public Member Functions

 Iterator (typename QueryComponents::iterator current, typename QueryComponents::iterator end)
 Constructs an iterator for the query.
 
Iteratoroperator++ ()
 Advances the iterator to the next entity.
 
reference operator* () const
 Dereferences the iterator to access the current entity's components.
 
bool operator!= (const Iterator &other) const
 Compares two iterators for inequality.
 

Detailed Description

template<typename... Components>
class vecs::Query< Components >::Iterator

Iterator for iterating over entities matching the query.

The Iterator class provides a way to iterate through the entities that match the specified components.

Member Typedef Documentation

◆ pointer

template<typename... Components>
using vecs::Query< Components >::Iterator::pointer
Initial value:
std::tuple<
typename QueryTypeTraits<Components>::IterationPointerType...>

◆ value_type

template<typename... Components>
using vecs::Query< Components >::Iterator::value_type
Initial value:
std::tuple<typename QueryTypeTraits<Components>::IterationType...>

Constructor & Destructor Documentation

◆ Iterator()

template<typename... Components>
vecs::Query< Components >::Iterator::Iterator ( typename QueryComponents::iterator current,
typename QueryComponents::iterator end )
inline

Constructs an iterator for the query.

Parameters
currentThe starting iterator position.
endThe end iterator position.

Member Function Documentation

◆ operator!=()

template<typename... Components>
bool vecs::Query< Components >::Iterator::operator!= ( const Iterator & other) const
inline

Compares two iterators for inequality.

Parameters
otherThe iterator to compare against.
Returns
True if the iterators are not equal, otherwise false.

◆ operator*()

template<typename... Components>
reference vecs::Query< Components >::Iterator::operator* ( ) const
inline

Dereferences the iterator to access the current entity's components.

Returns
A tuple containing references to the entity's components.

◆ operator++()

template<typename... Components>
Iterator & vecs::Query< Components >::Iterator::operator++ ( )
inline

Advances the iterator to the next entity.

Returns
Reference to the iterator after increment.

The documentation for this class was generated from the following file: