Function patch

Synopsis

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

template <typename Component, typename... Func>
decltype(auto) patch(const entity_type entity, Func &&... func)

Description

Patches the given component for an entity.

The signature of the functions should be equivalent to the following:

void(Component &);

Note
Empty types aren't explicitly instantiated and therefore they are never returned. However, this function can be used to trigger an update signal for them.
Warning
Attempting to use an invalid entity or to patch a component of an entity that doesn't own it results in undefined behavior.
Template Parameters

Component - Type of component to patch.

Func - Types of the function objects to invoke.

Parameters

entity - A valid entity identifier.

func - Valid function objects.

Return
A reference to the patched component.

Source

Lines 656-660 in src/entt/entity/registry.hpp.

template<typename Component, typename... Func>
decltype(auto) patch(const entity_type entity, Func &&... func) {
    ENTT_ASSERT(valid(entity));
    return assure<Component>().patch(*this, entity, std::forward<Func>(func)...);
}





Add Discussion

Log in to comment