Function target

Summary

#include <include/flecs/addons/cpp/entity_view.hpp>

(1) template <typename First>
    flecs::entity target(int32_t index=0) const

(2) flecs::entity target(flecs::entity_t first, int32_t index=0) const

Function overload

Synopsis

#include <include/flecs/addons/cpp/entity_view.hpp>

template <typename First>
flecs::entity target(int32_t index=0) const

Description

Get target for a given pair. This operation returns the target for a given pair. The optional index can be used to iterate through targets, in case the entity has multiple instances for the same relationship.

Template Parameters

First - The first element of the pair.

Parameters

index - The index (0 for the first instance of the relationship).

Mentioned in

Source

Lines 35-40 in include/flecs/addons/cpp/mixins/entity/impl.hpp. Line 339 in include/flecs/addons/cpp/entity_view.hpp.

template<typename First>
inline flecs::entity entity_view::target(int32_t index) const 
{
    return flecs::entity(m_world, 
        ecs_get_target(m_world, m_id, _::cpp_type<First>::id(m_world), index));
}

Synopsis

#include <include/flecs/addons/cpp/entity_view.hpp>

flecs::entity target(flecs::entity_t first, int32_t index=0) const

Description

Get target for a given pair. This operation returns the target for a given pair. The optional index can be used to iterate through targets, in case the entity has multiple instances for the same relationship.

Parameters

first - The first element of the pair for which to retrieve the target.

index - The index (0 for the first instance of the relationship).

Mentioned in

Source

Lines 42-48 in include/flecs/addons/cpp/mixins/entity/impl.hpp. Line 349 in include/flecs/addons/cpp/entity_view.hpp.

inline flecs::entity entity_view::target(
    flecs::entity_t relationship, 
    int32_t index) const 
{
    return flecs::entity(m_world, 
        ecs_get_target(m_world, m_id, relationship, index));
}