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

A container for a single entity and its components, as a result of a query. More...

#include <vecs.h>

Public Member Functions

 Single ()=default
 Default constructor for an invalid state.
 
 Single (const std::tuple< Components *... > &components)
 Constructs a valid Single result from a tuple of component pointers.
 
std::tuple< Components &... > operator* ()
 Dereferences the components.
 
 operator bool () const
 Checks if the Single is valid.
 

Friends

class Query
 

Detailed Description

template<typename... Components>
struct vecs::Query< Components >::Single

A container for a single entity and its components, as a result of a query.

The Single struct represents the result of a single entity matching the query, including references to its components.

Constructor & Destructor Documentation

◆ Single()

template<typename... Components>
vecs::Query< Components >::Single::Single ( const std::tuple< Components *... > & components)
inline

Constructs a valid Single result from a tuple of component pointers.

Parameters
componentsThe tuple of component pointers to be dereferenced.

Member Function Documentation

◆ operator bool()

template<typename... Components>
vecs::Query< Components >::Single::operator bool ( ) const
inline

Checks if the Single is valid.

Returns
True if the Single contains valid component references, otherwise false.

◆ operator*()

template<typename... Components>
std::tuple< Components &... > vecs::Query< Components >::Single::operator* ( )
inline

Dereferences the components.

Returns
A tuple containing references to the components.
Note
Asserts if called on an invalid Single.

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