Flecs: flecs::ref< T > Struct Template Reference
Description: A fast entity component system (ECS) for C & C++

| Flecs v4.0 A fast entity component system (ECS) for C & C++

Loading...
Searching...
No Matches
flecs::ref< T > Struct Template Reference
C++ API » Core » Refs

Component reference. More...

`#include <ref.hpp>`

Inheritance diagram for flecs::ref< T >:
[legend]

## Public Member Functions
| ref (world_t *world, entity_t entity, flecs::id_t id=0)
| ref (flecs::entity entity, flecs::id_t id=0)
T * | operator-> ()
T * | get ()
T * | try_get ()
Public Member Functions inherited from flecs::untyped_ref
| untyped_ref (world_t *world, entity_t entity, flecs::id_t id)
| untyped_ref (flecs::entity entity, flecs::id_t id)
flecs::entity | entity () const
| Return entity associated with reference.
flecs::id | component () const
| Return component associated with reference.
void * | get ()
bool | has ()
| operator bool ()
| implicit conversion to bool.
void * | try_get ()

## Detailed Description

template<typename T>
struct flecs::ref< T >

Component reference.

Reference to a component from a specific entity.

Definition at line 85 of file ref.hpp.

## Constructor & Destructor Documentation

## ◆ ref() [1/3]

template<typename T>

flecs::ref< T >::ref | ( |  | ) |
| inline

Definition at line 86 of file ref.hpp.

## ◆ ref() [2/3]

template<typename T>

flecs::ref< T >::ref | ( | world_t * | world,
|  | entity_t | entity,
|  | flecs::id_t | id = 0 )
| inline

Definition at line 88 of file ref.hpp.

## ◆ ref() [3/3]

template<typename T>

flecs::ref< T >::ref | ( | flecs::entity | entity,
|  | flecs::id_t | id = 0 )

Definition at line 18 of file impl.hpp.

## Member Function Documentation

## ◆ get()

template<typename T>

T * flecs::ref< T >::get | ( |  | ) |
| inline

Definition at line 103 of file ref.hpp.

## ◆ operator->()

template<typename T>

T * flecs::ref< T >::operator-> | ( |  | ) |
| inline

Definition at line 94 of file ref.hpp.

## ◆ try_get()

template<typename T>

T * flecs::ref< T >::try_get | ( |  | ) |
| inline

Definition at line 107 of file ref.hpp.

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

- include/flecs/addons/cpp/flecs.hpp
- include/flecs/addons/cpp/ref.hpp
- include/flecs/addons/cpp/mixins/entity/impl.hpp