Explorar o código

sparse_set: minor changes

Michele Caini %!s(int64=2) %!d(string=hai) anos
pai
achega
8332e59c62
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/entt/entity/sparse_set.hpp

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

@@ -668,7 +668,7 @@ public:
 
 
     /*! @copydoc begin Useful only in case of swap-only policy. */
     /*! @copydoc begin Useful only in case of swap-only policy. */
     [[nodiscard]] iterator begin(int) const noexcept {
     [[nodiscard]] iterator begin(int) const noexcept {
-        return begin() + static_cast<typename iterator::difference_type>((size() - static_cast<size_type>(head)) * (mode == deletion_policy::swap_only));
+        return (mode == deletion_policy::swap_only) ? (end() - static_cast<typename iterator::difference_type>(head)) : begin();
     }
     }
 
 
     /*! @copydoc cbegin Useful only in case of swap-only policy. */
     /*! @copydoc cbegin Useful only in case of swap-only policy. */