Explorar o código

view: size -> size_hint for multi component views (close #553)

Michele Caini %!s(int64=5) %!d(string=hai) anos
pai
achega
9290b4eecc
Modificáronse 1 ficheiros con 10 adicións e 1 borrados
  1. 10 1
      src/entt/entity/view.hpp

+ 10 - 1
src/entt/entity/view.hpp

@@ -350,12 +350,21 @@ public:
         return std::get<pool_type<Comp> *>(pools)->size();
     }
 
+    /**
+    * @brief Estimates the number of entities iterated by the view.
+    * @return Estimated number of entities iterated by the view.
+    */
+    [[nodiscard]] size_type size_hint() const ENTT_NOEXCEPT {
+        return (std::min)({ std::get<pool_type<Component> *>(pools)->size()... });
+    }
+
     /**
      * @brief Estimates the number of entities iterated by the view.
      * @return Estimated number of entities iterated by the view.
      */
+    [[deprecated("misleading name, use size_hint instead")]]
     [[nodiscard]] size_type size() const ENTT_NOEXCEPT {
-        return (std::min)({ std::get<pool_type<Component> *>(pools)->size()... });
+        return size_hint();
     }
 
     /**