Function any

Synopsis

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

template <typename... Component>
bool any(const entity_type entity) const

Description

Checks if an entity has at least one of the given components.

Warning
Attempting to use an invalid entity results in undefined behavior.
Template Parameters

Component - Components for which to perform the check.

Parameters

entity - A valid entity identifier.

Return
True if the entity has at least one of the given components, false otherwise.

Source

Lines 795-799 in src/entt/entity/registry.hpp.

template<typename... Component>
[[nodiscard]] bool any(const entity_type entity) const {
    ENTT_ASSERT(valid(entity));
    return (assure<Component>().contains(entity) || ...);
}





Add Discussion

Log in to comment