Преглед изворни кода

storage: consume args for empty types in all cases

Michele Caini пре 6 година
родитељ
комит
97e0d63102
2 измењених фајлова са 5 додато и 5 уклоњено
  1. 1 0
      TODO
  2. 4 5
      src/entt/entity/storage.hpp

+ 1 - 0
TODO

@@ -15,6 +15,7 @@
 * document undocumented parts (entt::overload and a few others)
 * any-of rule for views/groups (eg entity has A and any of B/C/D)
   - get -> all, exclude -> none
+* review multi component views to reduce instantiations once empty types are gone...
 
 Next:
 * replace observer class with observer functions

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

@@ -694,16 +694,15 @@ public:
      *
      * @tparam Args Types of arguments to use to construct the object.
      * @param entt A valid entity identifier.
+     * @param args Parameters to use to construct an object for the entity.
      */
     template<typename... Args>
-    void emplace(const entity_type entt, Args &&...) {
+    void emplace(const entity_type entt, Args &&... args) {
+        [[maybe_unused]] object_type instance{std::forward<Args>(args)...};
         underlying_type::construct(entt);
     }
 
-    /**
-     * @copydoc emplace
-     * @param args Parameters to use to construct an object for the entity.
-     */
+    /*! @copydoc emplace */
     template<typename... Args>
     [[deprecated("use ::emplace instead")]]
     void construct(const entity_type entt, Args &&... args) {