Function component

Synopsis

#include <include/flecs/cpp/component.hpp>

template <typename T>
flecs::entity component(const flecs::world &world, const char *name=nullptr)

Description

Regular component with ctor, dtor copy and move actions

Mentioned in

Source

Lines 697-707 in include/flecs/cpp/component.hpp.

template <typename T>
flecs::entity component(const flecs::world& world, const char *name = nullptr) {
    flecs::entity result = pod_component<T>(world, name);

    if (_::cpp_type<T>::size()) {
        _::register_lifecycle_actions<T>(world.c_ptr(), result.id(),
            true, true, true, true);
    }

    return result;
}