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
Public Member Functions | List of all members
flecs::ref< T > Struct Template Reference
C++ API » Core » Refs

Component reference. More...

`#include <ref.hpp>`

## 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 ()
bool | has ()
| operator bool ()
| implicit conversion to bool.
flecs::entity | entity () const

## Detailed Description

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

Component reference.

Reference to a component from a specific entity.

Definition at line 23 of file ref.hpp.

## Constructor & Destructor Documentation

## ◆ ref() [1/3]

template<typename T>

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

Definition at line 24 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 26 of file ref.hpp.

## ◆ ref() [3/3]

template<typename T>

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

Definition at line 43 of file ref.hpp.

## Member Function Documentation

## ◆ entity()

template<typename T>

flecs::entity flecs::ref< T >::entity | ( |  | ) | const

Definition at line 11 of file impl.hpp.

## ◆ get()

template<typename T>

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

Definition at line 56 of file ref.hpp.

## ◆ has()

template<typename T>

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

Definition at line 69 of file ref.hpp.

## ◆ operator bool()

template<typename T>

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

implicit conversion to bool.

return true if there is a valid T* being referred to

Definition at line 74 of file ref.hpp.

## ◆ operator->()

template<typename T>

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

Definition at line 46 of file ref.hpp.

## ◆ try_get()

template<typename T>

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

Definition at line 61 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