Explorar el Código

registry: avoid casting return types directly to better support empty storage

Michele Caini hace 3 años
padre
commit
6e2d871844
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      src/entt/entity/registry.hpp

+ 1 - 1
src/entt/entity/registry.hpp

@@ -1008,7 +1008,7 @@ public:
     template<typename... Type>
     [[nodiscard]] decltype(auto) get([[maybe_unused]] const entity_type entt) {
         if constexpr(sizeof...(Type) == 1u) {
-            return (const_cast<Type &>(std::as_const(*this).template get<Type>(entt)), ...);
+            return (static_cast<storage_for_type<Type> &>(assure<std::remove_const_t<Type>>()).get(entt), ...);
         } else {
             return std::forward_as_tuple(get<Type>(entt)...);
         }