entity/invoke: properly decay deduced argument to avoid nasty errors with reference types

This commit is contained in:
Michele Caini
2022-05-24 14:11:19 +02:00
parent 497fb90b12
commit fe3b5b03eb

View File

@@ -89,7 +89,7 @@ private:
* @param reg A registry that contains the given entity and its components.
* @param entt Entity from which to get the component.
*/
template<auto Member, typename Registry = nth_argument_t<0u, Member>>
template<auto Member, typename Registry = std::remove_const_t<std::remove_reference_t<nth_argument_t<0u, Member>>>>
void invoke(Registry &reg, const typename Registry::entity_type entt) {
static_assert(std::is_member_function_pointer_v<decltype(Member)>, "Invalid pointer to non-static member function");
delegate<void(Registry &, const typename Registry::entity_type)> func;