107 constexpr auto single() -> std::optional<std::tuple<Args...>>
148 requires(!detail::func_decomposer<F>::is_const)
150 using view_t =
typename detail::func_decomposer<F>::view_t;
151 view_t{ *
this }.each(std::forward<F>(func));
164 constexpr void each(F&& func)
const
165 requires(detail::func_decomposer<F>::is_const)
167 using view_t =
typename detail::func_decomposer<F>::view_t;
168 view_t{ *
this }.each(std::forward<F>(func));
173 [[nodiscard]]
constexpr std::size_t
size() const noexcept {
179 [[nodiscard]]
constexpr bool empty() const noexcept {
Definition base_registry.hpp:35
constexpr auto create_impl(Components &&... args) -> entity
Definition base_registry.hpp:141
detail::sparse_map< typename entity::id_t, entity_location > _entity_archetype_map
Definition base_registry.hpp:295
Represents a reference to an entity within a registry.
Definition entity_ref.hpp:355
Represents a reference to an entity within a registry.
Definition entity_ref.hpp:13
Registry is a container for all our entities and components. Components are stored in continuously in...
Definition registry.hpp:13
constexpr std::size_t size() const noexcept
Returns the number of enitites in the registry.
Definition registry.hpp:173
constexpr auto create(Components &&... args) -> entity_ref
Creates a new entity and attaches the specified components to it.
Definition registry.hpp:39
constexpr auto single() const -> std::optional< std::tuple< Args... > >
Returns a single tuple of components matching Args, if available in the view.
Definition registry.hpp:120
constexpr void each(F &&func) const
Executes a given function on each entity that matches the specified component requirements,...
Definition registry.hpp:164
constexpr auto single() -> std::optional< std::tuple< Args... > > requires(!const_component_references_v< Args... >)
Returns a single tuple of components matching Args, if available in the view.
Definition registry.hpp:107
constexpr bool empty() const noexcept
Checks if the registry currently manages any entities.
Definition registry.hpp:179
constexpr auto get_entity(entity ent) const noexcept -> const_entity_ref
Retrieves a constant reference to an entity.
Definition registry.hpp:63
constexpr auto get_entity(entity ent) noexcept -> entity_ref
Retrieves a mutable reference to an entity.
Definition registry.hpp:51
constexpr auto get_entity_const(entity ent) const noexcept -> const_entity_ref
Retrieves a constant reference to an entity (alias).
Definition registry.hpp:76
constexpr void each(F &&func)
Executes a given function on each entity that matches the specified component requirements.
Definition registry.hpp:147
constexpr auto view() -> co_ecs::view< Args... > requires(!const_component_references_v< Args... >)
Create a non-const view based on component query in parameter pack.
Definition registry.hpp:85
constexpr auto view() const -> co_ecs::view< Args... >
Create a const view based on component query in parameter pack.
Definition registry.hpp:97
A view lets you get a range over components of Args out of a registry.
Definition view.hpp:36
Component reference concept. It should be a reference or const reference to C, where C satisfies comp...
Definition component.hpp:94
Component concept. The component must be a struct/class that can be move constructed and move assigna...
Definition component.hpp:86
Definition archetype.hpp:11
constexpr bool const_component_references_v
Returns true when all Args are const references.
Definition component.hpp:142
detail::handle< struct entity_tag_t > entity
Represents an entity, consisting of an ID and generation.
Definition entity.hpp:13