Function type_id

Synopsis

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

template <typename T>
flecs::entity_t type_id()

Description

Get id currently assigned to component. If no world has registered the component yet, this operation will return 0.

Source

Lines 481-488 in include/flecs/addons/cpp/component.hpp.

template <typename T>
flecs::entity_t type_id() {
    if (_::cpp_type<T>::s_reset_count == ecs_cpp_reset_count_get()) {
        return _::cpp_type<T>::s_id;
    } else {
        return 0;
    }
}