doc: component <-> element

This commit is contained in:
Michele Caini
2024-03-15 11:37:00 +01:00
parent 283753a3ff
commit b8a0031d9c
14 changed files with 311 additions and 311 deletions

View File

@@ -15,7 +15,7 @@ void update(entt::registry &registry) {
auto view = registry.view<position, velocity>();
for(auto entity: view) {
// gets only the components that are going to be used ...
// gets only the elements that are going to be used ...
auto &vel = view.get<velocity>(entity);
@@ -28,7 +28,7 @@ void update(entt::registry &registry) {
void update(std::uint64_t dt, entt::registry &registry) {
registry.view<position, velocity>().each([dt](auto &pos, auto &vel) {
// gets all the components of the view at once ...
// gets all the elements of the view at once ...
pos.x += vel.dx * dt;
pos.y += vel.dy * dt;

View File

@@ -66,7 +66,7 @@ using sparse_set = basic_sparse_set<>;
/**
* @brief Alias declaration for the most common use case.
* @tparam Type Type of objects assigned to the entities.
* @tparam Type Element type.
*/
template<typename Type>
using storage = basic_storage<Type>;
@@ -140,7 +140,7 @@ template<typename... Type>
inline constexpr exclude_t<Type...> exclude{};
/**
* @brief Alias for lists of observed components.
* @brief Alias for lists of observed elements.
* @tparam Type List of types.
*/
template<typename... Type>
@@ -150,14 +150,14 @@ struct get_t final: type_list<Type...> {
};
/**
* @brief Variable template for lists of observed components.
* @brief Variable template for lists of observed elements.
* @tparam Type List of types.
*/
template<typename... Type>
inline constexpr get_t<Type...> get{};
/**
* @brief Alias for lists of owned components.
* @brief Alias for lists of owned elements.
* @tparam Type List of types.
*/
template<typename... Type>
@@ -167,7 +167,7 @@ struct owned_t final: type_list<Type...> {
};
/**
* @brief Variable template for lists of owned components.
* @brief Variable template for lists of owned elements.
* @tparam Type List of types.
*/
template<typename... Type>

View File

@@ -268,7 +268,7 @@ class basic_group;
* Iterators aren't invalidated if:
*
* * New elements are added to the storage.
* * The entity currently pointed is modified (for example, components are added
* * The entity currently pointed is modified (for example, elements are added
* or removed from it).
* * The entity currently pointed is destroyed.
*
@@ -332,9 +332,9 @@ public:
}
/**
* @brief Returns the storage for a given component type, if any.
* @tparam Type Type of component of which to return the storage.
* @return The storage for the given component type.
* @brief Returns the storage for a given element type, if any.
* @tparam Type Type of element of which to return the storage.
* @return The storage for the given element type.
*/
template<typename Type>
[[nodiscard]] auto *storage() const noexcept {
@@ -487,11 +487,11 @@ public:
}
/**
* @brief Returns the components assigned to the given entity.
* @tparam Type Type of the component to get.
* @tparam Other Other types of components to get.
* @brief Returns the elements assigned to the given entity.
* @tparam Type Type of the element to get.
* @tparam Other Other types of elements to get.
* @param entt A valid identifier.
* @return The components assigned to the entity.
* @return The elements assigned to the entity.
*/
template<typename Type, typename... Other>
[[nodiscard]] decltype(auto) get(const entity_type entt) const {
@@ -499,10 +499,10 @@ public:
}
/**
* @brief Returns the components assigned to the given entity.
* @tparam Index Indexes of the components to get.
* @brief Returns the elements assigned to the given entity.
* @tparam Index Indexes of the elements to get.
* @param entt A valid identifier.
* @return The components assigned to the entity.
* @return The elements assigned to the entity.
*/
template<std::size_t... Index>
[[nodiscard]] decltype(auto) get(const entity_type entt) const {
@@ -518,12 +518,12 @@ public:
}
/**
* @brief Iterates entities and components and applies the given function
* @brief Iterates entities and elements and applies the given function
* object to them.
*
* The function object is invoked for each entity. It is provided with the
* entity itself and a set of references to non-empty components. The
* _constness_ of the components is as requested.<br/>
* entity itself and a set of references to non-empty elements. The
* _constness_ of the elements is as requested.<br/>
* The signature of the function must be equivalent to one of the following
* forms:
*
@@ -554,8 +554,8 @@ public:
* @brief Returns an iterable object to use to _visit_ a group.
*
* The iterable object returns tuples that contain the current entity and a
* set of references to its non-empty components. The _constness_ of the
* components is as requested.
* set of references to its non-empty elements. The _constness_ of the
* elements is as requested.
*
* @note
* Empty types aren't explicitly instantiated and therefore they are never
@@ -592,8 +592,8 @@ public:
* * An iterator past the last element of the range to sort.
* * A comparison function to use to compare the elements.
*
* @tparam Type Optional type of component to compare.
* @tparam Other Other optional types of components to compare.
* @tparam Type Optional type of element to compare.
* @tparam Other Other optional types of elements to compare.
* @tparam Compare Type of comparison function object.
* @tparam Sort Type of sort function object.
* @tparam Args Types of arguments to forward to the sort function object.
@@ -611,7 +611,7 @@ public:
*
* @sa sort
*
* @tparam Index Optional indexes of components to compare.
* @tparam Index Optional indexes of elements to compare.
* @tparam Compare Type of comparison function object.
* @tparam Sort Type of sort function object.
* @tparam Args Types of arguments to forward to the sort function object.
@@ -668,7 +668,7 @@ private:
*
* * It's guaranteed that the entity list is tightly packed in memory for fast
* iterations.
* * It's guaranteed that all components in the owned storage are tightly packed
* * It's guaranteed that all elements in the owned storage are tightly packed
* in memory for even faster iterations and to allow direct access.
* * They stay true to the order of the owned storage and all instances have the
* same order in memory.
@@ -680,7 +680,7 @@ private:
* Iterators aren't invalidated if:
*
* * New elements are added to the storage.
* * The entity currently pointed is modified (for example, components are added
* * The entity currently pointed is modified (for example, elements are added
* or removed from it).
* * The entity currently pointed is destroyed.
*
@@ -745,9 +745,9 @@ public:
}
/**
* @brief Returns the storage for a given component type, if any.
* @tparam Type Type of component of which to return the storage.
* @return The storage for the given component type.
* @brief Returns the storage for a given element type, if any.
* @tparam Type Type of element of which to return the storage.
* @return The storage for the given element type.
*/
template<typename Type>
[[nodiscard]] auto *storage() const noexcept {
@@ -885,11 +885,11 @@ public:
}
/**
* @brief Returns the components assigned to the given entity.
* @tparam Type Type of the component to get.
* @tparam Other Other types of components to get.
* @brief Returns the elements assigned to the given entity.
* @tparam Type Type of the element to get.
* @tparam Other Other types of elements to get.
* @param entt A valid identifier.
* @return The components assigned to the entity.
* @return The elements assigned to the entity.
*/
template<typename Type, typename... Other>
[[nodiscard]] decltype(auto) get(const entity_type entt) const {
@@ -897,10 +897,10 @@ public:
}
/**
* @brief Returns the components assigned to the given entity.
* @tparam Index Indexes of the components to get.
* @brief Returns the elements assigned to the given entity.
* @tparam Index Indexes of the elements to get.
* @param entt A valid identifier.
* @return The components assigned to the entity.
* @return The elements assigned to the entity.
*/
template<std::size_t... Index>
[[nodiscard]] decltype(auto) get(const entity_type entt) const {
@@ -916,12 +916,12 @@ public:
}
/**
* @brief Iterates entities and components and applies the given function
* @brief Iterates entities and elements and applies the given function
* object to them.
*
* The function object is invoked for each entity. It is provided with the
* entity itself and a set of references to non-empty components. The
* _constness_ of the components is as requested.<br/>
* entity itself and a set of references to non-empty elements. The
* _constness_ of the elements is as requested.<br/>
* The signature of the function must be equivalent to one of the following
* forms:
*
@@ -952,8 +952,8 @@ public:
* @brief Returns an iterable object to use to _visit_ a group.
*
* The iterable object returns tuples that contain the current entity and a
* set of references to its non-empty components. The _constness_ of the
* components is as requested.
* set of references to its non-empty elements. The _constness_ of the
* elements is as requested.
*
* @note
* Empty types aren't explicitly instantiated and therefore they are never
@@ -991,8 +991,8 @@ public:
* * An iterator past the last element of the range to sort.
* * A comparison function to use to compare the elements.
*
* @tparam Type Optional type of component to compare.
* @tparam Other Other optional types of components to compare.
* @tparam Type Optional type of element to compare.
* @tparam Other Other optional types of elements to compare.
* @tparam Compare Type of comparison function object.
* @tparam Sort Type of sort function object.
* @tparam Args Types of arguments to forward to the sort function object.
@@ -1010,7 +1010,7 @@ public:
*
* @sa sort
*
* @tparam Index Optional indexes of components to compare.
* @tparam Index Optional indexes of elements to compare.
* @tparam Compare Type of comparison function object.
* @tparam Sort Type of sort function object.
* @tparam Args Types of arguments to forward to the sort function object.

View File

@@ -203,137 +203,137 @@ struct basic_handle {
}
/**
* @brief Assigns the given component to a handle.
* @tparam Component Type of component to create.
* @tparam Args Types of arguments to use to construct the component.
* @param args Parameters to use to initialize the component.
* @return A reference to the newly created component.
* @brief Assigns the given element to a handle.
* @tparam Type Type of element to create.
* @tparam Args Types of arguments to use to construct the element.
* @param args Parameters to use to initialize the element.
* @return A reference to the newly created element.
*/
template<typename Component, typename... Args>
template<typename Type, typename... Args>
decltype(auto) emplace(Args &&...args) const {
static_assert(((sizeof...(Scope) == 0) || ... || std::is_same_v<Component, Scope>), "Invalid type");
return reg->template emplace<Component>(entt, std::forward<Args>(args)...);
static_assert(((sizeof...(Scope) == 0) || ... || std::is_same_v<Type, Scope>), "Invalid type");
return reg->template emplace<Type>(entt, std::forward<Args>(args)...);
}
/**
* @brief Assigns or replaces the given component for a handle.
* @tparam Component Type of component to assign or replace.
* @tparam Args Types of arguments to use to construct the component.
* @param args Parameters to use to initialize the component.
* @return A reference to the newly created component.
* @brief Assigns or replaces the given element for a handle.
* @tparam Type Type of element to assign or replace.
* @tparam Args Types of arguments to use to construct the element.
* @param args Parameters to use to initialize the element.
* @return A reference to the newly created element.
*/
template<typename Component, typename... Args>
template<typename Type, typename... Args>
decltype(auto) emplace_or_replace(Args &&...args) const {
static_assert(((sizeof...(Scope) == 0) || ... || std::is_same_v<Component, Scope>), "Invalid type");
return reg->template emplace_or_replace<Component>(entt, std::forward<Args>(args)...);
static_assert(((sizeof...(Scope) == 0) || ... || std::is_same_v<Type, Scope>), "Invalid type");
return reg->template emplace_or_replace<Type>(entt, std::forward<Args>(args)...);
}
/**
* @brief Patches the given component for a handle.
* @tparam Component Type of component to patch.
* @brief Patches the given element for a handle.
* @tparam Type Type of element to patch.
* @tparam Func Types of the function objects to invoke.
* @param func Valid function objects.
* @return A reference to the patched component.
* @return A reference to the patched element.
*/
template<typename Component, typename... Func>
template<typename Type, typename... Func>
decltype(auto) patch(Func &&...func) const {
static_assert(((sizeof...(Scope) == 0) || ... || std::is_same_v<Component, Scope>), "Invalid type");
return reg->template patch<Component>(entt, std::forward<Func>(func)...);
static_assert(((sizeof...(Scope) == 0) || ... || std::is_same_v<Type, Scope>), "Invalid type");
return reg->template patch<Type>(entt, std::forward<Func>(func)...);
}
/**
* @brief Replaces the given component for a handle.
* @tparam Component Type of component to replace.
* @tparam Args Types of arguments to use to construct the component.
* @param args Parameters to use to initialize the component.
* @return A reference to the component being replaced.
* @brief Replaces the given element for a handle.
* @tparam Type Type of element to replace.
* @tparam Args Types of arguments to use to construct the element.
* @param args Parameters to use to initialize the element.
* @return A reference to the element being replaced.
*/
template<typename Component, typename... Args>
template<typename Type, typename... Args>
decltype(auto) replace(Args &&...args) const {
static_assert(((sizeof...(Scope) == 0) || ... || std::is_same_v<Component, Scope>), "Invalid type");
return reg->template replace<Component>(entt, std::forward<Args>(args)...);
static_assert(((sizeof...(Scope) == 0) || ... || std::is_same_v<Type, Scope>), "Invalid type");
return reg->template replace<Type>(entt, std::forward<Args>(args)...);
}
/**
* @brief Removes the given components from a handle.
* @tparam Component Types of components to remove.
* @return The number of components actually removed.
* @brief Removes the given elements from a handle.
* @tparam Type Types of elements to remove.
* @return The number of elements actually removed.
*/
template<typename... Component>
template<typename... Type>
size_type remove() const {
static_assert(sizeof...(Scope) == 0 || (type_list_contains_v<type_list<Scope...>, Component> && ...), "Invalid type");
return reg->template remove<Component...>(entt);
static_assert(sizeof...(Scope) == 0 || (type_list_contains_v<type_list<Scope...>, Type> && ...), "Invalid type");
return reg->template remove<Type...>(entt);
}
/**
* @brief Erases the given components from a handle.
* @tparam Component Types of components to erase.
* @brief Erases the given elements from a handle.
* @tparam Type Types of elements to erase.
*/
template<typename... Component>
template<typename... Type>
void erase() const {
static_assert(sizeof...(Scope) == 0 || (type_list_contains_v<type_list<Scope...>, Component> && ...), "Invalid type");
reg->template erase<Component...>(entt);
static_assert(sizeof...(Scope) == 0 || (type_list_contains_v<type_list<Scope...>, Type> && ...), "Invalid type");
reg->template erase<Type...>(entt);
}
/**
* @brief Checks if a handle has all the given components.
* @tparam Component Components for which to perform the check.
* @return True if the handle has all the components, false otherwise.
* @brief Checks if a handle has all the given elements.
* @tparam Type Elements for which to perform the check.
* @return True if the handle has all the elements, false otherwise.
*/
template<typename... Component>
template<typename... Type>
[[nodiscard]] decltype(auto) all_of() const {
return reg->template all_of<Component...>(entt);
return reg->template all_of<Type...>(entt);
}
/**
* @brief Checks if a handle has at least one of the given components.
* @tparam Component Components for which to perform the check.
* @return True if the handle has at least one of the given components,
* @brief Checks if a handle has at least one of the given elements.
* @tparam Type Elements for which to perform the check.
* @return True if the handle has at least one of the given elements,
* false otherwise.
*/
template<typename... Component>
template<typename... Type>
[[nodiscard]] decltype(auto) any_of() const {
return reg->template any_of<Component...>(entt);
return reg->template any_of<Type...>(entt);
}
/**
* @brief Returns references to the given components for a handle.
* @tparam Component Types of components to get.
* @return References to the components owned by the handle.
* @brief Returns references to the given elements for a handle.
* @tparam Type Types of elements to get.
* @return References to the elements owned by the handle.
*/
template<typename... Component>
template<typename... Type>
[[nodiscard]] decltype(auto) get() const {
static_assert(sizeof...(Scope) == 0 || (type_list_contains_v<type_list<Scope...>, Component> && ...), "Invalid type");
return reg->template get<Component...>(entt);
static_assert(sizeof...(Scope) == 0 || (type_list_contains_v<type_list<Scope...>, Type> && ...), "Invalid type");
return reg->template get<Type...>(entt);
}
/**
* @brief Returns a reference to the given component for a handle.
* @tparam Component Type of component to get.
* @tparam Args Types of arguments to use to construct the component.
* @param args Parameters to use to initialize the component.
* @return Reference to the component owned by the handle.
* @brief Returns a reference to the given element for a handle.
* @tparam Type Type of element to get.
* @tparam Args Types of arguments to use to construct the element.
* @param args Parameters to use to initialize the element.
* @return Reference to the element owned by the handle.
*/
template<typename Component, typename... Args>
template<typename Type, typename... Args>
[[nodiscard]] decltype(auto) get_or_emplace(Args &&...args) const {
static_assert(((sizeof...(Scope) == 0) || ... || std::is_same_v<Component, Scope>), "Invalid type");
return reg->template get_or_emplace<Component>(entt, std::forward<Args>(args)...);
static_assert(((sizeof...(Scope) == 0) || ... || std::is_same_v<Type, Scope>), "Invalid type");
return reg->template get_or_emplace<Type>(entt, std::forward<Args>(args)...);
}
/**
* @brief Returns pointers to the given components for a handle.
* @tparam Component Types of components to get.
* @return Pointers to the components owned by the handle.
* @brief Returns pointers to the given elements for a handle.
* @tparam Type Types of elements to get.
* @return Pointers to the elements owned by the handle.
*/
template<typename... Component>
template<typename... Type>
[[nodiscard]] auto try_get() const {
static_assert(sizeof...(Scope) == 0 || (type_list_contains_v<type_list<Scope...>, Component> && ...), "Invalid type");
return reg->template try_get<Component...>(entt);
static_assert(sizeof...(Scope) == 0 || (type_list_contains_v<type_list<Scope...>, Type> && ...), "Invalid type");
return reg->template try_get<Type...>(entt);
}
/**
* @brief Checks if a handle has components assigned.
* @return True if the handle has no components assigned, false otherwise.
* @brief Checks if a handle has elements assigned.
* @return True if the handle has no elements assigned, false otherwise.
*/
[[nodiscard]] bool orphan() const {
return reg->orphan(entt);

View File

@@ -100,10 +100,10 @@ private:
/**
* @brief Helper to create a listener that directly invokes a member function.
* @tparam Member Member function to invoke on a component of the given type.
* @tparam Member Member function to invoke on an element of the given type.
* @tparam Registry Basic registry type.
* @param reg A registry that contains the given entity and its components.
* @param entt Entity from which to get the component.
* @param reg A registry that contains the given entity and its elements.
* @param entt Entity from which to get the element.
*/
template<auto Member, typename Registry = std::decay_t<nth_argument_t<0u, decltype(Member)>>>
void invoke(Registry &reg, const typename Registry::entity_type entt) {
@@ -114,16 +114,16 @@ void invoke(Registry &reg, const typename Registry::entity_type entt) {
}
/**
* @brief Returns the entity associated with a given component.
* @brief Returns the entity associated with a given element.
*
* @warning
* Currently, this function only works correctly with the default storage as it
* makes assumptions about how the components are laid out.
* makes assumptions about how the elements are laid out.
*
* @tparam Args Storage type template parameters.
* @param storage A storage that contains the given component.
* @param instance A valid component instance.
* @return The entity associated with the given component.
* @param storage A storage that contains the given element.
* @param instance A valid element instance.
* @return The entity associated with the given element.
*/
template<typename... Args>
typename basic_storage<Args...>::entity_type to_entity(const basic_storage<Args...> &storage, const typename basic_storage<Args...>::value_type &instance) {

View File

@@ -38,8 +38,8 @@ template<>
struct basic_collector<> {
/**
* @brief Adds a grouping matcher to the collector.
* @tparam AllOf Types of components tracked by the matcher.
* @tparam NoneOf Types of components used to filter out entities.
* @tparam AllOf Types of elements tracked by the matcher.
* @tparam NoneOf Types of elements used to filter out entities.
* @return The updated collector.
*/
template<typename... AllOf, typename... NoneOf>
@@ -49,7 +49,7 @@ struct basic_collector<> {
/**
* @brief Adds an observing matcher to the collector.
* @tparam AnyOf Type of component for which changes should be detected.
* @tparam AnyOf Type of element for which changes should be detected.
* @return The updated collector.
*/
template<typename AnyOf>
@@ -73,8 +73,8 @@ struct basic_collector<matcher<type_list<Reject...>, type_list<Require...>, Rule
/**
* @brief Adds a grouping matcher to the collector.
* @tparam AllOf Types of components tracked by the matcher.
* @tparam NoneOf Types of components used to filter out entities.
* @tparam AllOf Types of elements tracked by the matcher.
* @tparam NoneOf Types of elements used to filter out entities.
* @return The updated collector.
*/
template<typename... AllOf, typename... NoneOf>
@@ -84,7 +84,7 @@ struct basic_collector<matcher<type_list<Reject...>, type_list<Require...>, Rule
/**
* @brief Adds an observing matcher to the collector.
* @tparam AnyOf Type of component for which changes should be detected.
* @tparam AnyOf Type of element for which changes should be detected.
* @return The updated collector.
*/
template<typename AnyOf>
@@ -94,8 +94,8 @@ struct basic_collector<matcher<type_list<Reject...>, type_list<Require...>, Rule
/**
* @brief Updates the filter of the last added matcher.
* @tparam AllOf Types of components required by the matcher.
* @tparam NoneOf Types of components used to filter out entities.
* @tparam AllOf Types of elements required by the matcher.
* @tparam NoneOf Types of elements used to filter out entities.
* @return The updated collector.
*/
template<typename... AllOf, typename... NoneOf>
@@ -114,13 +114,13 @@ inline constexpr basic_collector<> collector{};
* An observer returns all the entities and only the entities that fit the
* requirements of at least one matcher. Moreover, it's guaranteed that the
* entity list is tightly packed in memory for fast iterations.<br/>
* In general, observers don't stay true to the order of any set of components.
* In general, observers don't stay true to the order of any set of elements.
*
* Observers work mainly with two types of matchers, provided through a
* collector:
*
* * Observing matcher: an observer will return at least all the living entities
* for which one or more of the given components have been updated and not yet
* for which one or more of the given elements have been updated and not yet
* destroyed.
* * Grouping matcher: an observer will return at least all the living entities
* that would have entered the given group if it existed and that would have
@@ -140,13 +140,13 @@ inline constexpr basic_collector<> collector{};
*
* Iterators aren't invalidated if:
*
* * New instances of the given components are created and assigned to entities.
* * New instances of the given elements are created and assigned to entities.
* * The entity currently pointed is modified (as an example, if one of the
* given components is removed from the entity to which the iterator points).
* given elements is removed from the entity to which the iterator points).
* * The entity currently pointed is destroyed.
*
* In all the other cases, modifying the pools of the given components in any
* way invalidates all the iterators.
* In all the other cases, modifying the pools of the given elements in any way
* invalidates all the iterators.
*
* @warning
* Lifetime of an observer doesn't necessarily have to overcome that of the

View File

@@ -430,10 +430,10 @@ public:
}
/**
* @brief Returns the storage for a given component type.
* @tparam Type Type of component of which to return the storage.
* @brief Returns the storage for a given element type.
* @tparam Type Type of element of which to return the storage.
* @param id Optional name used to map the storage within the registry.
* @return The storage for the given component type.
* @return The storage for the given element type.
*/
template<typename Type>
storage_for_type<Type> &storage(const id_type id = type_hash<Type>::value()) {
@@ -441,10 +441,10 @@ public:
}
/**
* @brief Returns the storage for a given component type, if any.
* @tparam Type Type of component of which to return the storage.
* @brief Returns the storage for a given element type, if any.
* @tparam Type Type of element of which to return the storage.
* @param id Optional name used to map the storage within the registry.
* @return The storage for the given component type.
* @return The storage for the given element type.
*/
template<typename Type>
const storage_for_type<Type> *storage(const id_type id = type_hash<Type>::value()) const {
@@ -509,7 +509,7 @@ public:
* @brief Destroys an entity and releases its identifier.
*
* @warning
* Adding or removing components to an entity that is being destroyed can
* Adding or removing elements to an entity that is being destroyed can
* result in undefined behavior.
*
* @param entt A valid identifier.
@@ -564,19 +564,19 @@ public:
}
/**
* @brief Assigns the given component to an entity.
* @brief Assigns the given element to an entity.
*
* The component must have a proper constructor or be of aggregate type.
* The element must have a proper constructor or be of aggregate type.
*
* @warning
* Attempting to assign a component to an entity that already owns it
* results in undefined behavior.
* Attempting to assign an element to an entity that already owns it results
* in undefined behavior.
*
* @tparam Type Type of component to create.
* @tparam Args Types of arguments to use to construct the component.
* @tparam Type Type of element to create.
* @tparam Args Types of arguments to use to construct the element.
* @param entt A valid identifier.
* @param args Parameters to use to initialize the component.
* @return A reference to the newly created component.
* @param args Parameters to use to initialize the element.
* @return A reference to the newly created element.
*/
template<typename Type, typename... Args>
decltype(auto) emplace(const entity_type entt, Args &&...args) {
@@ -585,15 +585,15 @@ public:
}
/**
* @brief Assigns each entity in a range the given component.
* @brief Assigns each entity in a range the given element.
*
* @sa emplace
*
* @tparam Type Type of component to create.
* @tparam Type Type of element to create.
* @tparam It Type of input iterator.
* @param first An iterator to the first element of the range of entities.
* @param last An iterator past the last element of the range of entities.
* @param value An instance of the component to assign.
* @param value An instance of the element to assign.
*/
template<typename Type, typename It>
void insert(It first, It last, const Type &value = {}) {
@@ -602,16 +602,16 @@ public:
}
/**
* @brief Assigns each entity in a range the given components.
* @brief Assigns each entity in a range the given elements.
*
* @sa emplace
*
* @tparam Type Type of component to create.
* @tparam Type Type of element to create.
* @tparam EIt Type of input iterator.
* @tparam CIt Type of input iterator.
* @param first An iterator to the first element of the range of entities.
* @param last An iterator past the last element of the range of entities.
* @param from An iterator to the first element of the range of components.
* @param from An iterator to the first element of the range of elements.
*/
template<typename Type, typename EIt, typename CIt, typename = std::enable_if_t<std::is_same_v<typename std::iterator_traits<CIt>::value_type, Type>>>
void insert(EIt first, EIt last, CIt from) {
@@ -620,16 +620,16 @@ public:
}
/**
* @brief Assigns or replaces the given component for an entity.
* @brief Assigns or replaces the given element for an entity.
*
* @sa emplace
* @sa replace
*
* @tparam Type Type of component to assign or replace.
* @tparam Args Types of arguments to use to construct the component.
* @tparam Type Type of element to assign or replace.
* @tparam Args Types of arguments to use to construct the element.
* @param entt A valid identifier.
* @param args Parameters to use to initialize the component.
* @return A reference to the newly created component.
* @param args Parameters to use to initialize the element.
* @return A reference to the newly created element.
*/
template<typename Type, typename... Args>
decltype(auto) emplace_or_replace(const entity_type entt, Args &&...args) {
@@ -642,7 +642,7 @@ public:
}
/**
* @brief Patches the given component for an entity.
* @brief Patches the given element for an entity.
*
* The signature of the function should be equivalent to the following:
*
@@ -651,14 +651,14 @@ public:
* @endcode
*
* @warning
* Attempting to patch a component of an entity that doesn't own it
* results in undefined behavior.
* Attempting to patch an element of an entity that doesn't own it results
* in undefined behavior.
*
* @tparam Type Type of component to patch.
* @tparam Type Type of element to patch.
* @tparam Func Types of the function objects to invoke.
* @param entt A valid identifier.
* @param func Valid function objects.
* @return A reference to the patched component.
* @return A reference to the patched element.
*/
template<typename Type, typename... Func>
decltype(auto) patch(const entity_type entt, Func &&...func) {
@@ -666,19 +666,19 @@ public:
}
/**
* @brief Replaces the given component for an entity.
* @brief Replaces the given element for an entity.
*
* The component must have a proper constructor or be of aggregate type.
* The element must have a proper constructor or be of aggregate type.
*
* @warning
* Attempting to replace a component of an entity that doesn't own it
* results in undefined behavior.
* Attempting to replace an element of an entity that doesn't own it results
* in undefined behavior.
*
* @tparam Type Type of component to replace.
* @tparam Args Types of arguments to use to construct the component.
* @tparam Type Type of element to replace.
* @tparam Args Types of arguments to use to construct the element.
* @param entt A valid identifier.
* @param args Parameters to use to initialize the component.
* @return A reference to the component being replaced.
* @param args Parameters to use to initialize the element.
* @return A reference to the element being replaced.
*/
template<typename Type, typename... Args>
decltype(auto) replace(const entity_type entt, Args &&...args) {
@@ -686,11 +686,11 @@ public:
}
/**
* @brief Removes the given components from an entity.
* @tparam Type Type of component to remove.
* @tparam Other Other types of components to remove.
* @brief Removes the given elements from an entity.
* @tparam Type Type of element to remove.
* @tparam Other Other types of elements to remove.
* @param entt A valid identifier.
* @return The number of components actually removed.
* @return The number of elements actually removed.
*/
template<typename Type, typename... Other>
size_type remove(const entity_type entt) {
@@ -698,16 +698,16 @@ public:
}
/**
* @brief Removes the given components from all the entities in a range.
* @brief Removes the given elements from all the entities in a range.
*
* @sa remove
*
* @tparam Type Type of component to remove.
* @tparam Other Other types of components to remove.
* @tparam Type Type of element to remove.
* @tparam Other Other types of elements to remove.
* @tparam It Type of input iterator.
* @param first An iterator to the first element of the range of entities.
* @param last An iterator past the last element of the range of entities.
* @return The number of components actually removed.
* @return The number of elements actually removed.
*/
template<typename Type, typename... Other, typename It>
size_type remove(It first, It last) {
@@ -735,14 +735,14 @@ public:
}
/**
* @brief Erases the given components from an entity.
* @brief Erases the given elements from an entity.
*
* @warning
* Attempting to erase a component from an entity that doesn't own it
* results in undefined behavior.
* Attempting to erase an element from an entity that doesn't own it results
* in undefined behavior.
*
* @tparam Type Types of components to erase.
* @tparam Other Other types of components to erase.
* @tparam Type Types of elements to erase.
* @tparam Other Other types of elements to erase.
* @param entt A valid identifier.
*/
template<typename Type, typename... Other>
@@ -751,12 +751,12 @@ public:
}
/**
* @brief Erases the given components from all the entities in a range.
* @brief Erases the given elements from all the entities in a range.
*
* @sa erase
*
* @tparam Type Types of components to erase.
* @tparam Other Other types of components to erase.
* @tparam Type Types of elements to erase.
* @tparam Other Other types of elements to erase.
* @tparam It Type of input iterator.
* @param first An iterator to the first element of the range of entities.
* @param last An iterator past the last element of the range of entities.
@@ -783,7 +783,7 @@ public:
}
/**
* @brief Erases components satisfying specific criteria from an entity.
* @brief Erases elements satisfying specific criteria from an entity.
*
* The function type is equivalent to:
*
@@ -808,8 +808,8 @@ public:
/**
* @brief Removes all tombstones from a registry or only the pools for the
* given components.
* @tparam Type Types of components for which to clear all tombstones.
* given elements.
* @tparam Type Types of elements for which to clear all tombstones.
*/
template<typename... Type>
void compact() {
@@ -851,15 +851,15 @@ public:
}
/**
* @brief Returns references to the given components for an entity.
* @brief Returns references to the given elements for an entity.
*
* @warning
* Attempting to get a component from an entity that doesn't own it results
* Attempting to get an element from an entity that doesn't own it results
* in undefined behavior.
*
* @tparam Type Types of components to get.
* @tparam Type Types of elements to get.
* @param entt A valid identifier.
* @return References to the components owned by the entity.
* @return References to the elements owned by the entity.
*/
template<typename... Type>
[[nodiscard]] decltype(auto) get([[maybe_unused]] const entity_type entt) const {
@@ -881,19 +881,19 @@ public:
}
/**
* @brief Returns a reference to the given component for an entity.
* @brief Returns a reference to the given element for an entity.
*
* In case the entity doesn't own the component, the parameters provided are
* In case the entity doesn't own the element, the parameters provided are
* used to construct it.
*
* @sa get
* @sa emplace
*
* @tparam Type Type of component to get.
* @tparam Args Types of arguments to use to construct the component.
* @tparam Type Type of element to get.
* @tparam Args Types of arguments to use to construct the element.
* @param entt A valid identifier.
* @param args Parameters to use to initialize the component.
* @return Reference to the component owned by the entity.
* @param args Parameters to use to initialize the element.
* @return Reference to the element owned by the entity.
*/
template<typename Type, typename... Args>
[[nodiscard]] decltype(auto) get_or_emplace(const entity_type entt, Args &&...args) {
@@ -906,14 +906,14 @@ public:
}
/**
* @brief Returns pointers to the given components for an entity.
* @brief Returns pointers to the given elements for an entity.
*
* @note
* The registry retains ownership of the pointed-to components.
* The registry retains ownership of the pointed-to elements.
*
* @tparam Type Types of components to get.
* @tparam Type Types of elements to get.
* @param entt A valid identifier.
* @return Pointers to the components owned by the entity.
* @return Pointers to the elements owned by the entity.
*/
template<typename... Type>
[[nodiscard]] auto try_get([[maybe_unused]] const entity_type entt) const {
@@ -936,8 +936,8 @@ public:
}
/**
* @brief Clears a whole registry or the pools for the given components.
* @tparam Type Types of components to remove from their entities.
* @brief Clears a whole registry or the pools for the given elements.
* @tparam Type Types of elements to remove from their entities.
*/
template<typename... Type>
void clear() {
@@ -954,30 +954,30 @@ public:
}
/**
* @brief Checks if an entity has components assigned.
* @brief Checks if an entity has elements assigned.
* @param entt A valid identifier.
* @return True if the entity has no components assigned, false otherwise.
* @return True if the entity has no elements assigned, false otherwise.
*/
[[nodiscard]] bool orphan(const entity_type entt) const {
return std::none_of(pools.cbegin(), pools.cend(), [entt](auto &&curr) { return curr.second->contains(entt); });
}
/**
* @brief Returns a sink object for the given component.
* @brief Returns a sink object for the given element.
*
* Use this function to receive notifications whenever a new instance of the
* given component is created and assigned to an entity.<br/>
* given element is created and assigned to an entity.<br/>
* The function type for a listener is equivalent to:
*
* @code{.cpp}
* void(basic_registry<Entity> &, Entity);
* @endcode
*
* Listeners are invoked **after** assigning the component to the entity.
* Listeners are invoked **after** assigning the element to the entity.
*
* @sa sink
*
* @tparam Type Type of component of which to get the sink.
* @tparam Type Type of element of which to get the sink.
* @param id Optional name used to map the storage within the registry.
* @return A temporary sink object.
*/
@@ -987,21 +987,21 @@ public:
}
/**
* @brief Returns a sink object for the given component.
* @brief Returns a sink object for the given element.
*
* Use this function to receive notifications whenever an instance of the
* given component is explicitly updated.<br/>
* given element is explicitly updated.<br/>
* The function type for a listener is equivalent to:
*
* @code{.cpp}
* void(basic_registry<Entity> &, Entity);
* @endcode
*
* Listeners are invoked **after** updating the component.
* Listeners are invoked **after** updating the element.
*
* @sa sink
*
* @tparam Type Type of component of which to get the sink.
* @tparam Type Type of element of which to get the sink.
* @param id Optional name used to map the storage within the registry.
* @return A temporary sink object.
*/
@@ -1011,21 +1011,21 @@ public:
}
/**
* @brief Returns a sink object for the given component.
* @brief Returns a sink object for the given element.
*
* Use this function to receive notifications whenever an instance of the
* given component is removed from an entity and thus destroyed.<br/>
* given element is removed from an entity and thus destroyed.<br/>
* The function type for a listener is equivalent to:
*
* @code{.cpp}
* void(basic_registry<Entity> &, Entity);
* @endcode
*
* Listeners are invoked **before** removing the component from the entity.
* Listeners are invoked **before** removing the element from the entity.
*
* @sa sink
*
* @tparam Type Type of component of which to get the sink.
* @tparam Type Type of element of which to get the sink.
* @param id Optional name used to map the storage within the registry.
* @return A temporary sink object.
*/
@@ -1035,10 +1035,10 @@ public:
}
/**
* @brief Returns a view for the given components.
* @tparam Type Type of component used to construct the view.
* @tparam Other Other types of components used to construct the view.
* @tparam Exclude Types of components used to filter the view.
* @brief Returns a view for the given elements.
* @tparam Type Type of element used to construct the view.
* @tparam Other Other types of elements used to construct the view.
* @tparam Exclude Types of elements used to filter the view.
* @return A newly created view.
*/
template<typename Type, typename... Other, typename... Exclude>
@@ -1058,7 +1058,7 @@ public:
}
/**
* @brief Returns a group for the given components.
* @brief Returns a group for the given elements.
* @tparam Owned Types of storage _owned_ by the group.
* @tparam Get Types of storage _observed_ by the group, if any.
* @tparam Exclude Types of storage used to filter the group, if any.
@@ -1101,10 +1101,10 @@ public:
}
/**
* @brief Checks whether the given components belong to any group.
* @tparam Type Type of component in which one is interested.
* @tparam Other Other types of components in which one is interested.
* @return True if the pools of the given components are _free_, false
* @brief Checks whether the given elements belong to any group.
* @tparam Type Type of element in which one is interested.
* @tparam Other Other types of elements in which one is interested.
* @return True if the pools of the given elements are _free_, false
* otherwise.
*/
template<typename Type, typename... Other>
@@ -1114,7 +1114,7 @@ public:
}
/**
* @brief Sorts the elements of a given component.
* @brief Sorts the elements of a given element.
*
* The comparison function object returns `true` if the first element is
* _less_ than the second one, `false` otherwise. Its signature is also
@@ -1136,9 +1136,9 @@ public:
* passed along with the other parameters to this member function.
*
* @warning
* Pools of components owned by a group cannot be sorted.
* Pools of elements owned by a group cannot be sorted.
*
* @tparam Type Type of components to sort.
* @tparam Type Type of elements to sort.
* @tparam Compare Type of comparison function object.
* @tparam Sort Type of sort function object.
* @tparam Args Types of arguments to forward to the sort function object.
@@ -1160,17 +1160,17 @@ public:
}
/**
* @brief Sorts two pools of components in the same way.
* @brief Sorts two pools of elements in the same way.
*
* Entities and components in `To` which are part of both storage are sorted
* Entities and elements in `To` which are part of both storage are sorted
* internally with the order they have in `From`. The others follow in no
* particular order.
*
* @warning
* Pools of components owned by a group cannot be sorted.
* Pools of elements owned by a group cannot be sorted.
*
* @tparam To Type of components to sort.
* @tparam From Type of components to use to sort.
* @tparam To Type of elements to sort.
* @tparam From Type of elements to use to sort.
*/
template<typename To, typename From>
void sort() {

View File

@@ -98,15 +98,15 @@ private:
*
* Runtime views iterate over those entities that are at least in the given
* storage. During initialization, a runtime view looks at the number of
* entities available for each component and uses the smallest set in order to
* get a performance boost when iterating.
* entities available for each element and uses the smallest set in order to get
* a performance boost when iterating.
*
* @b Important
*
* Iterators aren't invalidated if:
*
* * New elements are added to the storage.
* * The entity currently pointed is modified (for example, components are added
* * The entity currently pointed is modified (for example, elements are added
* or removed from it).
* * The entity currently pointed is destroyed.
*
@@ -241,11 +241,11 @@ public:
/**
* @brief Returns an iterator to the first entity that has the given
* components.
* elements.
*
* If the view is empty, the returned iterator will be equal to `end()`.
*
* @return An iterator to the first entity that has the given components.
* @return An iterator to the first entity that has the given elements.
*/
[[nodiscard]] iterator begin() const {
return pools.empty() ? iterator{} : iterator{pools, filter, pools[0]->begin()};
@@ -253,9 +253,9 @@ public:
/**
* @brief Returns an iterator that is past the last entity that has the
* given components.
* given elements.
* @return An iterator to the entity following the last entity that has the
* given components.
* given elements.
*/
[[nodiscard]] iterator end() const {
return pools.empty() ? iterator{} : iterator{pools, filter, pools[0]->end()};

View File

@@ -37,7 +37,7 @@ void orphans(Registry &registry) {
* @brief Utility class to create snapshots from a registry.
*
* A _snapshot_ can be either a dump of the entire registry or a narrower
* selection of components of interest.<br/>
* selection of elements of interest.<br/>
* This type can be used in both cases if provided with a correctly configured
* output archive.
*
@@ -224,10 +224,10 @@ public:
}
/**
* @brief Destroys those entities that have no components.
* @brief Destroys those entities that have no elements.
*
* In case all the entities were serialized but only part of the components
* was saved, it could happen that some of the entities have no components
* In case all the entities were serialized but only part of the elements
* was saved, it could happen that some of the entities have no elements
* once restored.<br/>
* This function helps to identify and destroy those entities.
*
@@ -406,10 +406,10 @@ public:
}
/**
* @brief Destroys those entities that have no components.
* @brief Destroys those entities that have no elements.
*
* In case all the entities were serialized but only part of the components
* was saved, it could happen that some of the entities have no components
* In case all the entities were serialized but only part of the elements
* was saved, it could happen that some of the entities have no elements
* once restored.<br/>
* This function helps to identify and destroy those entities.
*

View File

@@ -223,7 +223,7 @@ template<typename... Lhs, typename... Rhs>
* Empty types aren't explicitly instantiated. Therefore, many of the functions
* normally available for non-empty types will not be available for empty ones.
*
* @tparam Type Type of objects assigned to the entities.
* @tparam Type Element type.
* @tparam Entity A valid entity type.
* @tparam Allocator Type of allocator used to manage memory and elements.
*/
@@ -737,7 +737,7 @@ public:
* @brief Returns an iterable object to use to _visit_ a storage.
*
* The iterable object returns a tuple that contains the current entity and
* a reference to its component.
* a reference to its element.
*
* @return An iterable object to use to _visit_ the storage.
*/

View File

@@ -193,8 +193,8 @@ template<typename... Lhs, typename... Rhs>
* View iterators aren't invalidated if:
*
* * New elements are added to the storage iterated by the view.
* * The entity currently returned is modified (for example, components are
* added or removed from it).
* * The entity currently returned is modified (for example, elements are added
* or removed from it).
* * The entity currently returned is destroyed.
*
* In all other cases, modifying the storage iterated by a view in any way can
@@ -447,8 +447,8 @@ public:
: basic_view{std::make_from_tuple<basic_view>(std::tuple_cat(value, excl))} {}
/**
* @brief Forces a view to use a given component to drive iterations
* @tparam Type Type of component to use to drive iterations.
* @brief Forces a view to use a given element to drive iterations
* @tparam Type Type of element to use to drive iterations.
*/
template<typename Type>
void use() noexcept {
@@ -456,8 +456,8 @@ public:
}
/**
* @brief Forces a view to use a given component to drive iterations
* @tparam Index Index of the component to use to drive iterations.
* @brief Forces a view to use a given element to drive iterations
* @tparam Index Index of the element to use to drive iterations.
*/
template<std::size_t Index>
void use() noexcept {
@@ -465,9 +465,9 @@ public:
}
/**
* @brief Returns the storage for a given component type, if any.
* @tparam Type Type of component of which to return the storage.
* @return The storage for the given component type.
* @brief Returns the storage for a given element type, if any.
* @tparam Type Type of element of which to return the storage.
* @return The storage for the given element type.
*/
template<typename Type>
[[nodiscard]] auto *storage() const noexcept {
@@ -519,20 +519,20 @@ public:
}
/**
* @brief Returns the components assigned to the given entity.
* @brief Returns the elements assigned to the given entity.
* @param entt A valid identifier.
* @return The components assigned to the given entity.
* @return The elements assigned to the given entity.
*/
[[nodiscard]] decltype(auto) operator[](const entity_type entt) const {
return get(entt);
}
/**
* @brief Returns the components assigned to the given entity.
* @tparam Type Type of the component to get.
* @tparam Other Other types of components to get.
* @brief Returns the elements assigned to the given entity.
* @tparam Type Type of the element to get.
* @tparam Other Other types of elements to get.
* @param entt A valid identifier.
* @return The components assigned to the entity.
* @return The elements assigned to the entity.
*/
template<typename Type, typename... Other>
[[nodiscard]] decltype(auto) get(const entity_type entt) const {
@@ -540,10 +540,10 @@ public:
}
/**
* @brief Returns the components assigned to the given entity.
* @tparam Index Indexes of the components to get.
* @brief Returns the elements assigned to the given entity.
* @tparam Index Indexes of the elements to get.
* @param entt A valid identifier.
* @return The components assigned to the entity.
* @return The elements assigned to the entity.
*/
template<std::size_t... Index>
[[nodiscard]] decltype(auto) get(const entity_type entt) const {
@@ -557,7 +557,7 @@ public:
}
/**
* @brief Iterates entities and components and applies the given function
* @brief Iterates entities and elements and applies the given function
* object to them.
*
* The signature of the function must be equivalent to one of the following
@@ -582,8 +582,8 @@ public:
* @brief Returns an iterable object to use to _visit_ a view.
*
* The iterable object returns a tuple that contains the current entity and
* a set of references to its non-empty components. The _constness_ of the
* components is as requested.
* a set of references to its non-empty elements. The _constness_ of the
* elements is as requested.
*
* @return An iterable object to use to _visit_ the view.
*/
@@ -593,7 +593,7 @@ public:
/**
* @brief Combines two views in a _more specific_ one.
* @tparam OGet Component list of the view to combine with.
* @tparam OGet Element list of the view to combine with.
* @tparam OExclude Filter list of the view to combine with.
* @param other The view to combine with.
* @return A more specific view.
@@ -641,8 +641,8 @@ public:
}
/**
* @brief Returns the number of entities that have the given component.
* @return Number of entities that have the given component.
* @brief Returns the number of entities that have the given element.
* @return Number of entities that have the given element.
*/
[[nodiscard]] size_type size() const noexcept {
return leading ? leading->size() : size_type{};
@@ -795,13 +795,13 @@ public:
: basic_view{std::get<0>(value)} {}
/**
* @brief Returns the storage for a given component type, if any.
* @tparam Type Type of component of which to return the storage.
* @return The storage for the given component type.
* @brief Returns the storage for a given element type, if any.
* @tparam Type Type of element of which to return the storage.
* @return The storage for the given element type.
*/
template<typename Type = typename Get::element_type>
[[nodiscard]] auto *storage() const noexcept {
static_assert(std::is_same_v<std::remove_const_t<Type>, typename Get::element_type>, "Invalid component type");
static_assert(std::is_same_v<std::remove_const_t<Type>, typename Get::element_type>, "Invalid element type");
return storage<0>();
}
@@ -836,31 +836,31 @@ public:
}
/**
* @brief Returns the component assigned to the given entity.
* @brief Returns the element assigned to the given entity.
* @param entt A valid identifier.
* @return The component assigned to the given entity.
* @return The element assigned to the given entity.
*/
[[nodiscard]] decltype(auto) operator[](const entity_type entt) const {
return storage()->get(entt);
}
/**
* @brief Returns the component assigned to the given entity.
* @tparam Elem Type of the component to get.
* @brief Returns the element assigned to the given entity.
* @tparam Elem Type of the element to get.
* @param entt A valid identifier.
* @return The component assigned to the entity.
* @return The element assigned to the entity.
*/
template<typename Elem>
[[nodiscard]] decltype(auto) get(const entity_type entt) const {
static_assert(std::is_same_v<std::remove_const_t<Elem>, typename Get::element_type>, "Invalid component type");
static_assert(std::is_same_v<std::remove_const_t<Elem>, typename Get::element_type>, "Invalid element type");
return get<0>(entt);
}
/**
* @brief Returns the component assigned to the given entity.
* @tparam Index Index of the component to get.
* @brief Returns the element assigned to the given entity.
* @tparam Index Index of the element to get.
* @param entt A valid identifier.
* @return The component assigned to the entity.
* @return The element assigned to the entity.
*/
template<std::size_t... Index>
[[nodiscard]] decltype(auto) get(const entity_type entt) const {
@@ -872,7 +872,7 @@ public:
}
/**
* @brief Iterates entities and components and applies the given function
* @brief Iterates entities and elements and applies the given function
* object to them.
*
* The signature of the function must be equivalent to one of the following
@@ -894,8 +894,8 @@ public:
std::apply(func, pack);
}
} else if constexpr(std::is_invocable_v<Func, decltype(*elem->begin())>) {
for(auto &&component: *elem) {
func(component);
for(auto &&curr: *elem) {
func(curr);
}
} else {
for(size_type pos = elem->size(); pos; --pos) {
@@ -909,8 +909,8 @@ public:
* @brief Returns an iterable object to use to _visit_ a view.
*
* The iterable object returns a tuple that contains the current entity and
* a reference to its component if it's a non-empty one. The _constness_ of
* the component is as requested.
* a reference to its element if it's a non-empty one. The _constness_ of
* the element is as requested.
*
* @return An iterable object to use to _visit_ the view.
*/
@@ -921,7 +921,7 @@ public:
/**
* @brief Combines two views in a _more specific_ one.
* @tparam OGet Component list of the view to combine with.
* @tparam OGet Element list of the view to combine with.
* @tparam OExclude Filter list of the view to combine with.
* @param other The view to combine with.
* @return A more specific view.
@@ -943,8 +943,8 @@ basic_view(Type &...storage) -> basic_view<get_t<Type...>, exclude_t<>>;
/**
* @brief Deduction guide.
* @tparam Get Types of components iterated by the view.
* @tparam Exclude Types of components used to filter the view.
* @tparam Get Types of elements iterated by the view.
* @tparam Exclude Types of elements used to filter the view.
*/
template<typename... Get, typename... Exclude>
basic_view(std::tuple<Get &...>, std::tuple<Exclude &...> = {}) -> basic_view<get_t<Get...>, exclude_t<Exclude...>>;

View File

@@ -1568,14 +1568,14 @@ TEST(Storage, MoveOnlyComponent) {
using value_type = std::unique_ptr<int>;
static_assert(!std::is_copy_assignable_v<value_type>, "Copy assignable types not allowed");
static_assert(std::is_move_assignable_v<value_type>, "Move assignable type required");
// the purpose is to ensure that move only components are always accepted
// the purpose is to ensure that move only types are always accepted
[[maybe_unused]] const entt::storage<value_type> pool;
}
TEST(Storage, NonMovableComponent) {
using value_type = std::pair<const int, const int>;
static_assert(!std::is_move_assignable_v<value_type>, "Move assignable types not allowed");
// the purpose is to ensure that non-movable components are always accepted
// the purpose is to ensure that non-movable types are always accepted
[[maybe_unused]] const entt::storage<value_type> pool;
}

View File

@@ -7,7 +7,7 @@
template<typename Type, typename Entity>
struct entt::storage_type<Type, Entity> {
// no signal regardless of component type ...
// no signal regardless of element type ...
using type = basic_storage<Type, Entity>;
};

View File

@@ -11,7 +11,7 @@ CR_EXPORT int cr_main(cr_plugin *ctx, cr_op operation) {
// forces things to break
auto &registry = *static_cast<entt::registry *>(ctx->userdata);
// forces the creation of the pool for the empty component
// forces the creation of the pool for the empty type
static_cast<void>(registry.storage<test::empty>());
const auto view = registry.view<test::boxed_int>();