Function emplace

Synopsis

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

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

Description

Assigns the given component to a handle.

See
basic_registry::emplace
Template Parameters

Component - Type of component to create.

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 124-128 in src/entt/entity/handle.hpp.

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





Add Discussion

Log in to comment