1#ifndef ENTT_ENTITY_HELPER_HPP
2#define ENTT_ENTITY_HELPER_HPP
7#include "../core/fwd.hpp"
8#include "../core/type_traits.hpp"
9#include "component.hpp"
21template<
typename Registry>
47 template<
typename Get,
typename Exclude>
60template<
typename Registry>
64 if constexpr(std::is_const_v<registry_type>) {
65 return reg.template group_if_exists<
typename Owned::element_type...>(
get_t<
typename Get::element_type...>{},
exclude_t<
typename Exclude::element_type...>{});
91 template<
typename Owned,
typename Get,
typename Exclude>
107template<auto Member,
typename Registry = std::decay_t<nth_argument_t<0u, decltype(Member)>>>
109 static_assert(std::is_member_function_pointer_v<
decltype(
Member)>,
"Invalid pointer to non-static member function");
125template<
typename...
Args>
128 static_assert(traits_type::page_size != 0
u,
"Unexpected page size");
130 const auto *
addr = std::addressof(instance);
132 for(
auto it = base.rbegin(), last = base.rend();
it < last;
it += traits_type::page_size) {
149template<
typename Registry>
167 template<
typename Type>
181 registry_type *bucket;
189template<
typename Registry,
typename Type>
250template<
typename Registry>
Converts a registry to a group.
typename registry_type::entity_type entity_type
Underlying entity identifier.
Registry registry_type
Type of registry to convert.
as_group(registry_type &source) noexcept
Constructs a converter for a given registry.
Converts a registry to a view.
as_view(registry_type &source) noexcept
Constructs a converter for a given registry.
typename registry_type::entity_type entity_type
Underlying entity identifier.
Registry registry_type
Type of registry to convert.
const value_type & get(const entity_type entt) const noexcept
Returns the object assigned to an entity.
element_type value_type
Type of the objects assigned to entities.
typename member_class< Member >::type member_class_t
Helper type.
constexpr entt_traits< Entity >::entity_type to_entity(const Entity value) noexcept
Returns the entity part once converted to the underlying type.
constexpr Type make_obj_using_allocator(const Allocator &allocator, Args &&...args)
Uses-allocator construction utility (waiting for C++20).
constexpr null_t null
Compile-time constant for null entities.
std::uint32_t id_type
Alias declaration for type identifiers.
constexpr get_t< Type... > get
Variable template for lists of observed elements.
basic_registry<> registry
Alias declaration for the most common use case.
void invoke(Registry ®, const typename Registry::entity_type entt)
Helper to create a listener that directly invokes a member function.
sigh_helper(Registry &) -> sigh_helper< Registry >
Deduction guide.
@ ref
Aliasing mode, the object points to a non-const element.
basic_storage< Type > storage
Alias declaration for the most common use case.
Common way to access various properties of components.
Alias for exclusion lists.
Alias for lists of observed elements.
Alias for lists of owned elements.
auto on_destroy(Args &&...args)
Forwards the call to on_destroy on the underlying storage.
auto on_construct(Args &&...args)
Forwards the call to on_construct on the underlying storage.
Registry registry_type
Registry type.
auto on_update(Args &&...args)
Forwards the call to on_update on the underlying storage.
sigh_helper(registry_type &ref, const id_type id=type_hash< Type >::value())
Constructs a helper for a given registry.
sigh_helper(registry_type &ref)
Constructs a helper for a given registry.
Registry registry_type
Registry type.
registry_type & registry() noexcept
Returns a reference to the underlying registry.
auto with(const id_type id=type_hash< Type >::value()) noexcept
Binds a properly initialized helper to a given signal type.
Primary template isn't defined on purpose.