Function get

Summary

#include <src/entt/entity/registry.hpp>

(1) template <typename... Component>
    decltype(auto) get([[maybe_unused]] const entity_type entity) const

(2) template <typename... Component>
    decltype(auto) get([[maybe_unused]] const entity_type entity)

Function overload

Synopsis

#include <src/entt/entity/registry.hpp>

template <typename... Component>
decltype(auto) get([[maybe_unused]] const entity_type entity) const

Description

Returns references to the given components for an entity.

Warning
Attempting to use an invalid entity or to get a component from an entity that doesn't own it results in undefined behavior.
Template Parameters

Component - Types of components to get.

Parameters

entity - A valid entity identifier.

Return
References to the components owned by the entity.

Source

Lines 812-821 in src/entt/entity/registry.hpp.

template<typename... Component>
[[nodiscard]] decltype(auto) get([[maybe_unused]] const entity_type entity) const {
    ENTT_ASSERT(valid(entity));
    if constexpr(sizeof...(Component) == 1) {
        return (assure<Component>().get(entity), ...);
    } else {
        return std::forward_as_tuple(assure<Component>().get(entity)...);
    }
}

Synopsis

#include <src/entt/entity/registry.hpp>

template <typename... Component>
decltype(auto) get([[maybe_unused]] const entity_type entity)

Description

Returns references to the given components for an entity.

Warning
Attempting to use an invalid entity or to get a component from an entity that doesn't own it results in undefined behavior.
Template Parameters

Component - Types of components to get.

Parameters

entity - A valid entity identifier.

Return
References to the components owned by the entity.

Source

Lines 824-833 in src/entt/entity/registry.hpp.

template<typename... Component>
[[nodiscard]] decltype(auto) get([[maybe_unused]] const entity_type entity) {
    ENTT_ASSERT(valid(entity));
    if constexpr(sizeof...(Component) == 1) {
        return (assure<Component>().get(entity), ...);
    } else {
        return std::forward_as_tuple(assure<Component>().get(entity)...);
    }
}





Add Discussion

Log in to comment