Explorar el Código

storage: branch-less each/reach, no scoped iterators

Michele Caini hace 2 años
padre
commit
9b81532ced
Se han modificado 1 ficheros con 4 adiciones y 2 borrados
  1. 4 2
      src/entt/entity/storage.hpp

+ 4 - 2
src/entt/entity/storage.hpp

@@ -1139,7 +1139,8 @@ public:
 
 
     /*! @copydoc each */
     /*! @copydoc each */
     [[nodiscard]] const_iterable each() const noexcept {
     [[nodiscard]] const_iterable each() const noexcept {
-        return {internal::extended_storage_iterator{base_type::cbegin(0)}, internal::extended_storage_iterator{base_type::cend(0)}};
+        const auto it = base_type::cend();
+        return const_iterable{it - base_type::free_list(), it};
     }
     }
 
 
     /**
     /**
@@ -1155,7 +1156,8 @@ public:
 
 
     /*! @copydoc reach */
     /*! @copydoc reach */
     [[nodiscard]] const_reverse_iterable reach() const noexcept {
     [[nodiscard]] const_reverse_iterable reach() const noexcept {
-        return {internal::extended_storage_iterator{base_type::crbegin(0)}, internal::extended_storage_iterator{base_type::crend(0)}};
+        const auto it = base_type::crbegin();
+        return const_reverse_iterable{it, it + base_type::free_list()};
     }
     }
 
 
 private:
 private: