Function emplace_or_replace

Synopsis

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

template <typename Component, typename... Args>
decltype(auto) emplace_or_replace(Args &&... args) const

Description

Assigns or replaces the given component for a handle.

See
basic_registry::emplace_or_replace
Template Parameters

Component - Type of component to assign or replace.

Args - Types of arguments to use to construct the component.

Parameters

args - Parameters to use to initialize the component.

Return
A reference to the newly created component.

Source

Lines 138-142 in src/entt/entity/handle.hpp.

template<typename Component, typename... Args>
decltype(auto) emplace_or_replace(Args &&... args) const {
    static_assert(((sizeof...(Type) == 0) || ... || std::is_same_v<Component, Type>));
    return reg->template emplace_or_replace<Component>(entt, std::forward<Args>(args)...);
}





Add Discussion

Log in to comment