Skip to content

Commit

Permalink
mixin: avoid shadow warnings/errors
Browse files Browse the repository at this point in the history
  • Loading branch information
skypjack committed Sep 20, 2024
1 parent f8eb94c commit e1e1d37
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions src/entt/entity/mixin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,35 +449,35 @@ class basic_reactive_mixin final: public Type {

/**
* @brief Makes storage _react_ to creation of objects of the given type.
* @tparam Type Type of element to _react_ to.
* @tparam Clazz Type of element to _react_ to.
* @tparam Candidate Function to use to _react_ to the event.
* @param id Optional name used to map the storage within the registry.
*/
template<typename Type, auto Candidate = &basic_reactive_mixin::emplace_element>
void on_construct(const id_type id = type_hash<Type>::value()) {
owner_or_assert().storage<Type>(id).on_construct().connect<Candidate>(*this);
template<typename Clazz, auto Candidate = &basic_reactive_mixin::emplace_element>
void on_construct(const id_type id = type_hash<Clazz>::value()) {
owner_or_assert().storage<Clazz>(id).on_construct().connect<Candidate>(*this);
}

/**
* @brief Makes storage _react_ to update of objects of the given type.
* @tparam Type Type of element to _react_ to.
* @tparam Clazz Type of element to _react_ to.
* @tparam Candidate Function to use to _react_ to the event.
* @param id Optional name used to map the storage within the registry.
*/
template<typename Type, auto Candidate = &basic_reactive_mixin::emplace_element>
void on_update(const id_type id = type_hash<Type>::value()) {
owner_or_assert().storage<Type>(id).on_update().connect<Candidate>(*this);
template<typename Clazz, auto Candidate = &basic_reactive_mixin::emplace_element>
void on_update(const id_type id = type_hash<Clazz>::value()) {
owner_or_assert().storage<Clazz>(id).on_update().connect<Candidate>(*this);
}

/**
* @brief Makes storage _react_ to destruction of objects of the given type.
* @tparam Type Type of element to _react_ to.
* @tparam Clazz Type of element to _react_ to.
* @tparam Candidate Function to use to _react_ to the event.
* @param id Optional name used to map the storage within the registry.
*/
template<typename Type, auto Candidate = &basic_reactive_mixin::emplace_element>
void on_destroy(const id_type id = type_hash<Type>::value()) {
owner_or_assert().storage<Type>(id).on_destroy().connect<Candidate>(*this);
template<typename Clazz, auto Candidate = &basic_reactive_mixin::emplace_element>
void on_destroy(const id_type id = type_hash<Clazz>::value()) {
owner_or_assert().storage<Clazz>(id).on_destroy().connect<Candidate>(*this);
}

/**
Expand All @@ -503,25 +503,25 @@ class basic_reactive_mixin final: public Type {

/**
* @brief Returns a view that is filtered by the underlying storage.
* @tparam Type Types of elements used to construct the view.
* @tparam Get 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... Exclude>
[[nodiscard]] basic_view<get_t<const basic_reactive_mixin, typename basic_registry_type::template storage_for_type<const Type>...>, exclude_t<typename basic_registry_type::template storage_for_type<const Exclude>...>>
template<typename... Get, typename... Exclude>
[[nodiscard]] basic_view<get_t<const basic_reactive_mixin, typename basic_registry_type::template storage_for_type<const Get>...>, exclude_t<typename basic_registry_type::template storage_for_type<const Exclude>...>>
view(exclude_t<Exclude...> = exclude_t{}) const {
const basic_registry_type &parent = owner_or_assert();
basic_view<get_t<const basic_reactive_mixin, typename basic_registry_type::template storage_for_type<const Type>...>, exclude_t<typename basic_registry_type::template storage_for_type<const Exclude>...>> elem{};
[&elem](const auto *...curr) { ((curr ? elem.storage(*curr) : void()), ...); }(parent.storage<std::remove_const_t<Exclude>>()..., parent.storage<std::remove_const_t<Type>>()..., this);
basic_view<get_t<const basic_reactive_mixin, typename basic_registry_type::template storage_for_type<const Get>...>, exclude_t<typename basic_registry_type::template storage_for_type<const Exclude>...>> elem{};
[&elem](const auto *...curr) { ((curr ? elem.storage(*curr) : void()), ...); }(parent.storage<std::remove_const_t<Exclude>>()..., parent.storage<std::remove_const_t<Get>>()..., this);
return elem;
}

/*! @copydoc view */
template<typename... Type, typename... Exclude>
[[nodiscard]] basic_view<get_t<const basic_reactive_mixin, typename basic_registry_type::template storage_for_type<Type>...>, exclude_t<typename basic_registry_type::template storage_for_type<Exclude>...>>
template<typename... Get, typename... Exclude>
[[nodiscard]] basic_view<get_t<const basic_reactive_mixin, typename basic_registry_type::template storage_for_type<Get>...>, exclude_t<typename basic_registry_type::template storage_for_type<Exclude>...>>
view(exclude_t<Exclude...> = exclude_t{}) {
basic_registry_type &parent = owner_or_assert();
return {*this, parent.storage<std::remove_const_t<Type>>()..., parent.storage<std::remove_const_t<Exclude>>()...};
return {*this, parent.storage<std::remove_const_t<Get>>()..., parent.storage<std::remove_const_t<Exclude>>()...};
}

private:
Expand Down

0 comments on commit e1e1d37

Please sign in to comment.